//tfirst oled 2k2V 105uF charger killed 3* stm32f103c8t6 9U boards 2k2V jumping anywhere.. so build new with ili9341 2.8C lcd color touchscreen(touch not used) and 93 board caused need last 9U board left for WS2812B projects //board STM32F103C8T6 minimum system board + tft: ILI9341 (240x320pixel 2,8" COLOR touchscreen LCD SPI1) +using Adafruit library with STM-master on Arduino IDE //supply 6x 18650 2.4Ah >> 14.4Ah total (3x tp4056 charger paralel, microusb ports) >>6A miniswitch >9900uF 10V > 4A boost stepup (seted to 12VDC< 25V 3300uF<)+ boost stepup (5V2A)>3300uF 10V > AMS1117 3V3 3300uF 10V //pins TFT ::VCC on 3.3V ::LED on 3.3V ::GND on GND :: CS on PB1 :: Reset on PB0 :: DC/RS on PA4 :: SCK on A5 :: MISO on A6 :: MOSI on A7 <150R red(+5V >2A100V diode>led, 10V 33 uF tantal Parralel to LED) #define grun PC14 //GPIO>150R gren(+5V >1A100V diode>led, 10V 33 uF tantal Parralel to LED) #define blau PC15 //GPIO>150R blue(+5V led, 10V 33 uF tantal Parralel to LED) //0603 singlecolors #define cgrun PB12 //emeralt #define crot PB5 #define cweis PB6 #define cblau PB7 //taster GPIOs 470R grounded, code function i created istinput(); is for anticlipping //7tasters on coverboard, tasterboard from broken lcd tv #define t7 PA15 #define t4 PA10 #define t3 PA9 #define t6 PA8 #define t5 PB15 #define t2 PB14 #define t1 PB13 //measure #define volt PA0 //+max 2200V>(9pcs 10kOhm)+470R+220R+10R+100R+100R+(*1)100R>GND inline *1(1uF capacitor parralel)>>GPIO analog measure used measurevalue*1000 =volt (49* 10kOhm inline)+470Ohm+30Ohm+(*gpio)470Ohm+30Ohm> GND (parralel to last 500Ohm bevore ground 100nF capacitor against peaks value 0-4096/125 for voltage #define temp PA1 //tempsensor(10k) grounding GPIO which is also connectet with 10kR to 3V3 //NPN =D882 3A SMD transistor #define npnled PA2//GPIO>150R UV(+5V, 10V 33 uF tantal Parralel) #define npnF PA3//GPIO>470R fan(+12V, 16V 200uF parrall) //booth mosftes have 6A switch caused not sure which working better original or irf3205 (booth N-channel mosfets) //mosfets pulsing +12V to ferrit 2kV inverter primecoil over 0.05R #define npna PB10 //mos1 GPIO> 470R>>NPN(J3Y)>>220R>>PNP(Y2)(12V)>>irf3205 #define npnb PB11 //mos2 GPIO> 470R>>NPN(J3Y)>>220R>>PNP(Y2)(12V)>>factorym mosfet #define npnP1 PB9//Ropen GPIO> 470R>> relai(+12V) freerunningdiode >(1A100V reversed parralel to relaicoil) #define npnP2 PB8//Rclose GPIO> 470R>> relai(+12V) freerunningdiode >(1A100V reversed parralel to relaicoil) //charger ciruit 2x ? 1000V factore highdrain diode to 2200V105uF capacitor or own rectifier build with 12* 1A 1000V diodes (3inline ever) #define TFT_CS PB1 #define TFT_DC PA4 #define TFT_RST PB0 #define swap(a, b) { int16_t t = a; a = b; b = t; } Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); // Use hardware SPI //like cats :3 so a cute OLED bootpicture const unsigned char PROGMEM cat [] = // width 66px height 46 { 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, // ## 0x00, 0x00, 0x0F, 0x0E, 0x18, 0x60, 0x00, 0x00, 0x00, // #### ### ## ## 0x00, 0x00, 0x04, 0x94, 0xF9, 0xE0, 0x00, 0x00, 0x00, // # # # # ##### #### 0x00, 0x00, 0x02, 0x67, 0xB7, 0x40, 0x00, 0x00, 0x00, // # ## #### ## ### # 0x00, 0x3F, 0xFC, 0x22, 0x26, 0x40, 0x00, 0x00, 0x00, // ############ # # # ## # 0x01, 0xE0, 0x04, 0x62, 0x2C, 0x60, 0x00, 0x00, 0x00, // #### # ## # # ## ## 0x07, 0x00, 0x00, 0x02, 0x38, 0x3F, 0xF8, 0x00, 0x00, // ### # ### ########### 0x3C, 0x00, 0x00, 0x02, 0x10, 0x00, 0x0F, 0x80, 0x00, // #### # # ##### 0x60, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, // ## ##### #### 0xDF, 0xE0, 0x7F, 0xE0, 0x01, 0xFE, 0x00, 0x1C, 0x00, // ## ######## ########## ######## ### 0xF0, 0x30, 0xFF, 0xF0, 0x07, 0xFF, 0x00, 0x07, 0x00, // #### ## ############ ########### ### 0x80, 0x18, 0xFF, 0xF0, 0x0F, 0xFF, 0x00, 0x01, 0x80, // # ## ############ ############ ## 0xC0, 0x31, 0xFF, 0xF8, 0x1F, 0xFF, 0x83, 0xFC, 0xC0, // ## ## ############## ############## ######## ## 0x41, 0x19, 0xFF, 0xF8, 0x1F, 0xFF, 0x82, 0x07, 0xC0, // # # ## ############## ############## # ##### 0x61, 0xF1, 0xFF, 0xF8, 0x1F, 0xFF, 0xCE, 0x00, 0x40, // ## ##### ############## ############### ### # 0x20, 0x81, 0xFF, 0xFC, 0x1F, 0xFF, 0xC7, 0xC0, 0x40, // # # ############### ############### ##### # 0x30, 0x71, 0xFF, 0xFC, 0x3F, 0xFF, 0xC0, 0x40, 0xC0, // ## ### ############### ################ # ## 0x10, 0x39, 0x3F, 0xE4, 0x3F, 0xFF, 0xC1, 0x80, 0x80, // # ### # ######### # ################ ## # 0x18, 0x41, 0x00, 0x04, 0x3F, 0xFE, 0x66, 0x00, 0x80, // ## # # # ############# ## ## # 0x0E, 0x01, 0xFF, 0xE4, 0x3F, 0xF0, 0x23, 0x01, 0x80, // ### ############ # ########## # ## ## 0x03, 0x01, 0xC0, 0x3C, 0x20, 0x00, 0x20, 0x03, 0x00, // ## ### #### # # ## 0x01, 0x81, 0x00, 0x08, 0x3F, 0x00, 0x20, 0x02, 0x00, // ## # # ###### # # 0x00, 0x80, 0x00, 0x00, 0x31, 0xFE, 0x60, 0x06, 0x00, // # ## ######## ## ## 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0xC0, 0x0C, 0x00, // ## #### ## 0x00, 0x70, 0x0F, 0xE0, 0x00, 0x00, 0xC0, 0x18, 0x00, // ### ####### ## ## 0x00, 0x1C, 0x38, 0x11, 0xE7, 0xF0, 0x00, 0x30, 0x00, // ### ### # #### ####### ## 0x00, 0x04, 0x60, 0xF1, 0xC3, 0x9C, 0x00, 0x60, 0x00, // # ## #### ### ### ### ## 0x00, 0x0C, 0xC1, 0x80, 0x80, 0xC6, 0x40, 0xC0, 0x00, // ## ## ## # ## ## # ## 0x00, 0x10, 0x83, 0x00, 0x00, 0x60, 0x67, 0x80, 0x00, // # # ## ## ## #### 0x00, 0xE0, 0x06, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, // ### ## #### 0x01, 0x80, 0x04, 0x00, 0x80, 0x80, 0x30, 0x00, 0x00, // ## # # # ## 0x00, 0xFF, 0x80, 0x20, 0x81, 0xF0, 0x0E, 0x00, 0x00, // ######### # # ##### ### 0x00, 0x18, 0x60, 0x11, 0xC6, 0x18, 0x03, 0xC0, 0x00, // ## ## # ### ## ## #### 0x00, 0x60, 0x00, 0x1F, 0x7C, 0x0C, 0x3C, 0x60, 0x00, // ## ##### ##### ## #### ## 0x00, 0x7F, 0x80, 0x14, 0x28, 0x04, 0x07, 0xC0, 0x00, // ######## # # # # # ##### 0x00, 0x43, 0xF0, 0x18, 0x1E, 0x34, 0x01, 0x00, 0x00, // # ###### ## #### ## # # 0x00, 0x02, 0x1C, 0x00, 0x02, 0x1C, 0x3D, 0x00, 0x00, // # ### # ### #### # 0x00, 0x06, 0x00, 0x00, 0x03, 0x10, 0x67, 0x80, 0x00, // ## ## # ## #### 0x00, 0x01, 0xC0, 0x00, 0x01, 0xB0, 0x34, 0x00, 0x00, // ### ## ## ## # 0x00, 0x00, 0x78, 0x00, 0x00, 0xE7, 0xF8, 0x00, 0x00, // #### ### ######## 0x00, 0x00, 0x0E, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, // ### ### 0x00, 0x00, 0x03, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ## # 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // # # 0x00, 0x00, 0x01, 0x80, 0x00, 0x60, 0x00, 0x00, 0x00, // ## ## 0x00, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, // # # 0x00, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, // # # }; #define graphsize 135 uint32_t rainbow[129] = {0xff0000,0xff0d00,0xff1a00,0xff2700,0xff3300,0xff4000,0xff4d00,0xff5a00,0xff6400,0xff6d00,0xff7700,0xff8100,0xff8a00,0xff9400,0xff9900,0xff9e00,0xffa300,0xffa700,0xffac00,0xffb100,0xffb600,0xffbb00,0xffbf00,0xffc400,0xffc900,0xffce00,0xffd200,0xffd700,0xfcde00,0xfae400,0xf7eb00,0xf4f200,0xf2f800,0xefff00,0xeaff00,0xe6ff00,0xe1ff00,0xddff00,0xd8ff00,0xd4ff00,0xcfff00,0xc7ff00,0xbfff00,0xb7ff00,0xafff00,0xa7ff00,0x9fff00,0x97ff00,0x8eff00,0x84ff00,0x7bff00,0x72ff00,0x68ff00,0x5fff00,0x51ff06,0x44ff0b,0x36ff11,0x29ff17,0x1bff1d,0x0eff22,0x00ff28,0x00ff3a,0x00ff4b,0x00ff5d,0x00ff6e,0x00ff80,0x00ff91,0x00ffa3,0x00ffab,0x00ffb3,0x00ffbb,0x00ffc3,0x00ffcb,0x00ffd3,0x00ffdb,0x00ffe0,0x00ffe6,0x00ffeb,0x00fff0,0x00fff6,0x00fffb,0x00f6fc,0x00edfc,0x00e4fd,0x00dbfd,0x00d2fe,0x00c9fe,0x00c0ff,0x00b6ff,0x00adff,0x00a3ff,0x009aff,0x0090ff,0x0087ff,0x007dff,0x0968ff,0x1253ff,0x1c3fff,0x252aff,0x2e15ff,0x3700ff,0x3c00ff,0x4000ff,0x4500ff,0x4a00ff,0x4f00ff,0x5300ff,0x5800ff,0x6200ff,0x6b00ff,0x7500ff,0x7f00ff,0x8900ff,0x9200ff,0x9c00ff,0x9f00ff,0xa300ff,0xa600ff,0xa900ff,0xad00ff,0xb000ff,0xa800f4,0xa000e8,0x9800dd,0x9100d1,0x8900c6,0x8100ba,0x7900af}; uint8_t r,g,b; void setup(){ delay(100); pinMode(rot,OUTPUT);pinMode(grun,OUTPUT);pinMode(blau,OUTPUT);pinMode(cgrun,OUTPUT);pinMode(cweis,OUTPUT);pinMode(crot,OUTPUT);pinMode(cblau,OUTPUT); pinMode(npnled,OUTPUT);pinMode(npnF,OUTPUT);pinMode(npna,OUTPUT);pinMode(npnb,OUTPUT);pinMode(npnP1,OUTPUT);pinMode(npnP2,OUTPUT); pinMode(t1,INPUT);pinMode(t2,INPUT); pinMode(t3,INPUT);pinMode(t4,INPUT);pinMode(t5,INPUT); pinMode(t6,INPUT);pinMode(t7,INPUT); displaystart(); onetime(); delay(600);} void displaystart(void) {tft.begin(); tft.fillScreen(ILI9341_BLACK); tft.setRotation(1);wuselbitmap(30,50,cat,66,46,0,"vertikal",100,true); textso(11,59,"DOOM voltage sourcer",1,0x0fff);textso(14,68,"by marderchen =^.^=",1,0xf0ff);} long maintime=millis();long littletime=micros();long slowtime=micros();long tiktak=millis();long dimmer2=micros();long slowtime2=millis(); uint16_t laag[8]={2,28,31,17,1,2},onpress[18],welch,positor; //0=erster an zeit, 1=bis 2=auszeit, 3=oft bis 2micros,4=soll,5kalt uint16_t messcach[3][graphsize+1]; boolean tplusset=false,tminusset=false,istan=false;uint8_t auswahlzi=0; void loop(){zeitreise();} void zeitreise(void){ while ((millis()- maintime) >= 8){maintime=millis();istinput();blinkyblinky();} while ((micros()- slowtime)>2000){messmal();slowtime = micros();} while ((millis()- tiktak) >= 30){writegraph();zeigmalher();tiktak=millis();} while ((micros()- littletime) >= 2){if(istan==true){derfan();pulspowder();}littletime = micros();}} void istinput(void){onpress[14]++; if (onpress[14] >=2) {onpress[14]=0; if (digitalRead(t1) == HIGH && onpress[0] ==0 && auswahlzi<8) {onpress[0]=1;auswahlzi++;} if (onpress[0]==1){onpress[1]++;}if(onpress[1]>=10){onpress[1]=0;onpress[0]=0;} if (digitalRead(t2) == HIGH && onpress[2] ==0&& auswahlzi >0) {onpress[2]=1;auswahlzi--;} if (onpress[2]==1){onpress[3]++;}if(onpress[3]>=15){onpress[3]=0;onpress[2]=0;} if (digitalRead(t3) == HIGH && onpress[4] ==0) { onpress[4] =1; } if (onpress[4]==1){onpress[5]++;}if(onpress[5]>=10){onpress[5]=0;onpress[4]=0;} if (digitalRead(t4) == HIGH && onpress[6] ==0) { onpress[6] =1; if(istan==true){istan=false;}else{istan=true;}} if (onpress[6]==1){onpress[7]++;}if(onpress[7]>=20){onpress[7]=0;onpress[6]=0;} if (digitalRead(t5) == HIGH && onpress[8] ==0) { onpress[8] =1; tminusset=true;} if (onpress[8]==1){onpress[9]++;}if(onpress[9]>=10){onpress[9]=0;onpress[8]=0;} if (digitalRead(t6) == HIGH && onpress[10] ==0) { onpress[10] =1; tplusset=true;} if (onpress[10]==1){onpress[11]++;}if(onpress[11]>=10){onpress[11]=0;onpress[10]=0;} if (digitalRead(t7) == HIGH && onpress[12] ==0) { onpress[12] =1; } if (onpress[12]==1){onpress[13]++;}if(onpress[13]>=10){onpress[13]=0;onpress[12]=0;} if((digitalRead(t1)||digitalRead(t2)||digitalRead(t3)||digitalRead(t4)||digitalRead(t5)||digitalRead(t6)||digitalRead(t7))==HIGH){digitalWrite(cblau,HIGH);}else{digitalWrite(cblau,LOW);} // for(uint8_t spring=0;spring<13;spring+=2){if (onpress[spring]>0){malconfiscreen();}} configdas(); }} uint8_t adder=1; void configdas() { if (auswahlzi==0) {adder=1; if (tplusset ==true && laag[0] <100) {tplusset=false; laag[0]+=adder;} if (tminusset==true && laag[0] >=adder){tminusset=false; laag[0]-=adder;}} if (auswahlzi==1) {adder=1; if (tplusset ==true && laag[1] <100) {tplusset=false; laag[1]+=adder;} if (tminusset==true && laag[1] >=adder){tminusset=false; laag[1]-=adder;}} if (auswahlzi==2) {adder=1; if (tplusset ==true && laag[2] <100) {tplusset=false; laag[2]+=adder;} if (tminusset==true && laag[2] >=adder){tminusset=false; laag[2]-=adder;}} if (auswahlzi==3) {adder=1; if (tplusset ==true && laag[3] <100) {tplusset=false; laag[3]+=adder;} if (tminusset==true && laag[3] >=adder){tminusset=false; laag[3]-=adder;}} if (auswahlzi==4) {adder=100; if (tplusset ==true && laag[4] <3000) {tplusset=false; laag[4]+=adder;} if (tminusset==true && laag[4] >=adder){tminusset=false; laag[4]-=adder;}} if (auswahlzi==5) {adder=10; if (tplusset ==true && laag[5] <100) {tplusset=false; laag[5]+=adder;} if (tminusset==true && laag[5] >=adder){tminusset=false; laag[5]-=adder;}} if (auswahlzi==6) {adder=1; if (tplusset ==true && laag[6] <100) {tplusset=false; laag[6]+=adder;} if (tminusset==true && laag[6] >=adder){tminusset=false; laag[6]-=adder;}} if (auswahlzi==7) {} if (auswahlzi==8) {} } int16_t voltig=10,warm=5,temper,spannung,fanPower; void blinkyblinky(void){ if(digitalRead(t7) == HIGH){onpress[15]=20;} if(onpress[15]>0){onpress[15]--;digitalWrite(npnP2,HIGH);}else{digitalWrite(npnP2,LOW);} if(onpress[15]>0 && (onpress[15]%2)==0){digitalWrite(rot,HIGH);}else{digitalWrite(rot,LOW);} onpress[16]++;if(onpress[16]>80){onpress[16]=0;} if((onpress[16]%40)==0 &&laag[4] >=(spannung-20)&&istan==true){digitalWrite(grun,HIGH);}else{digitalWrite(grun,LOW);} if((onpress[16]%10)==0 &&laag[4] >=(spannung-20)){digitalWrite(cgrun,HIGH);}else{digitalWrite(cgrun,LOW);} if((onpress[16]%4)==0 && laag[4] <(spannung-20)){digitalWrite(cweis,HIGH);}else{digitalWrite(cweis,LOW);} if((onpress[16]%20)==0 && laag[4] <(spannung-20)&&istan==true){digitalWrite(blau,HIGH);}else{digitalWrite(blau,LOW);} if((temper/10)>laag[5]&&(temper/10)<200&&(temper/10-laag[5])>fanPower){fanPower++;} if((temper/10)>laag[5]&&(temper/10)<200&&(temper/10-laag[5])2000){fanPower=200;} } uint8_t counter; void derfan(void){ if(counter==0){digitalWrite(npnF,HIGH); counter++;} if(counter==(fanPower+1)){digitalWrite(npnF,LOW);counter++;} counter++;if(counter>200){counter=0;} } void messmal(void){ voltig=(analogRead(volt)*100)/124;//voltig=analogRead(volt); if(voltig<4000&& voltig>spannung){spannung++;} if(voltig>0 && voltigwarm&& warm>0 ){temper--;} if(temperwoo2){tft.drawFastVLine(dar-scroll,woo+10,hoch-10,0x4400);} if((dar%5)==0&&(dar-scroll2)>woo2){for (uint8_t das=2;das<12;das++){tft.drawPixel(dar-scroll2,das*20-10,0x5600);}tft.drawPixel(dar-scroll2,hoch+woo,0xFF00);} tft.drawPixel(dar,woo+hoch-messcach[2][dar-woo2],0x000f);tft.drawPixel(dar,woo+hoch-messcach[0][dar-woo2]/teilstel,0xf00f);tft.drawPixel(dar,woo+hoch-messcach[1][dar-woo2]/teilstel,0x0ff0);} hier=woo+hoch-warm/teilstel;hierauch=woo+hoch-spannung/teilstel;hierf=woo+hoch-fanPower; for(uint16_t weg=woo2+graphsize;weg<(woo2+graphsize+mehr+8);weg++){tft.drawFastVLine(weg,hierf-5,12,0x0000);tft.drawFastVLine(weg,hier-5,12,0x0000);tft.drawFastVLine(weg,hierauch-5,12,0x0000);} tft.drawFastHLine(woo2+graphsize,hierf,5,0x000f); textso(woo2+graphsize+6,hierf-3,String(fanPower)+"L",1,0x000f); tft.drawFastHLine(woo2+graphsize,hier,5,0xffff); textso(woo2+graphsize+6,hier-3,String(warm),1,0xffff);tft.drawPixel(woo2+graphsize+17,hier+4,0xffff); tft.drawFastHLine(woo2+graphsize,hierauch,5,0xffff); textso(woo2+graphsize+6,hierauch-3,String(spannung)+"V",1,0xffff); tft.fillRect(woo2+2,2,graphsize+mehr+8,16,0x0000); dieda+=6; if(dieda>128){dieda=0;}colory(rainbow[dieda]); textso(woo2+50,woo-15,"Graphy",2,tft.color565(r,g,b)); tft.drawFastHLine(woo2+48,woo+2,74,tft.color565(r,g,b)); tft.drawRect(woo2-2,woo-20,graphsize+mehr+12,hoch+30,tft.color565(r,g,b)); // tft.drawRect(woo2,woo-18,graphsize+mehr+8,hoch+36,tft.color565(r,g,b)); colory(rainbow[128-dieda]); tft.drawRect(woo2-1,woo-19,graphsize+mehr+10,hoch+28,tft.color565(r,g,b)); tft.drawFastHLine(woo2+48,woo+4,74,tft.color565(r,g,b)); // tft.drawFastHLine(0,53,128,0x0ff0); } //for handling text and number disßplaying simpler //farbverlauf wusel zeugs int weniger=0; //thanks to adafruit for PROGMAN algoritm void wuselbitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t cpos,String way,int16_t scal,boolean reverse) { //scal = 1 /100) int16_t istcol=0;int16_t i, j, byteWidth = (w + 7) / 8; for(j=0; j> (i & 7))) { if (reverse ==false ) { tft.fillRect(x+(((i-w/2)*scal/100)-((w*(scal/100))/2)), y+(((j-h/2)*scal/100)-((h*(scal/100))/2)),scal/50,scal/50, tft.color565(r,g,b));} if (reverse ==true) { tft.drawPixel(x-(((i-w/2)*(scal/100))-((w*(scal/100))/2)), y+(((j-h/2)*(scal/100))-((h*(scal/100))/2)), tft.color565(r,g,b));} }}} } void textso(int xhier,int yhier,String was,int gros,int16_t colz){tft.setTextColor(colz);tft.setCursor(xhier,yhier);tft.setTextSize(gros); tft.print(was);} void zahlso(int xda,int yda,int mich,int grosz,int16_t colc){String michauch=""; tft.setTextSize(grosz); tft.setCursor(xda,yda); tft.setTextColor(colc); if (mich <9) {michauch+="0";} if (mich <99) {michauch+="0";} if (mich <999) {michauch+="0";} michauch+=mich; tft.println(michauch);} //kote by marderchen =^.^= use if you want :3 STM32F103C8T6 93 chip board used void wuselfillrect(int16_t eckex, int16_t eckey,int16_t breit, int16_t hoch,uint32_t colorspeed,boolean colormove) { for( int ry = eckex; ry < (hoch); ry++) { wuselline(eckex,eckey+ry,eckex+breit,eckey+ry,colorspeed,colormove);}} void wuselrect(int16_t eckex, int16_t eckey,int16_t breit, int16_t hoch,uint32_t colorspeed,boolean colormove) { wuselline(eckex+breit,eckey,eckex,eckey,colorspeed,colormove); wuselline(eckex+breit,eckey,eckex+breit,eckey+hoch,colorspeed,colormove); wuselline(eckex+breit,eckey+hoch,eckex,eckey+hoch,colorspeed,colormove); wuselline(eckex,eckey+hoch,eckex,eckey,colorspeed,colormove);} int rainbowcolor,rainbowcolor2,colorslows,colorslows2; //Bresenham's algorithm - thx wikpedia (and adafruit) but the marderchenmod void wuselline(int16_t x0, int16_t y0,int16_t x1, int16_t y1,uint32_t colorspeed,boolean colormove) { //if colormove =false, colorspeed = color ( 0xFF205B etc.) int16_t steep = abs(y1 - y0) > abs(x1 - x0); if (steep) {swap(x0, y0);swap(x1, y1);} if (x0 > x1) {swap(x0, x1);swap(y0, y1);} int16_t dx, dy;dx = x1 - x0;dy = abs(y1 - y0); int16_t err = dx / 2;int16_t ystep; if (y0 < y1) {ystep = 1;} else {ystep = -1;} for (; x0<=x1; x0++) {colorslows2++; if (colorslows2 >1) {rainbowcolor +=colorspeed; colorslows2=0;} if (rainbowcolor >=128) { rainbowcolor =0;} if (steep) { if (colormove == true) { colory(rainbow[rainbowcolor]); tft.drawPixel(y0, x0, tft.color565(r,g,b));}if (colormove == false) { colory(colorspeed); tft.drawPixel(y0, x0,tft.color565(r,g,b));} } else { if (colormove == true) { colory(rainbow[rainbowcolor]); tft.drawPixel(x0, y0, tft.color565(r,g,b));}if (colormove == false) { colory(colorspeed); tft.drawPixel(x0, y0, tft.color565(r,g,b));}} err -= dy;if (err < 0) {y0 += ystep;err += dx;}}} void colory(uint32_t colorz) { String hexcolor = String(colorz); int number = hexcolor.toInt(); r = number >> 16; g = number >> 8 & 0xFF; b = number & 0xFF;}