//suppply HSTNS-PD06 //board STM32F103C9T6 (64Kb 72Mhz) || tft: ILI9340C (240x320pixel 2,8" COLOR LCD SPI) || nyancat color testprogramm uses Adafruit library have fun =^.^= marderchen //pins connected ::VCC on 3.3V ::LED on 5V (with 94 Ohm resistor) ::GND on GND :: CS on A0 :: Reset on A1 :: DC/RS on A2 :: SCK on A5 :: MISO on A6 :: MOSI on A7 //temperatur graph writer and for vape power mosfet temperatur and supply+mosfet fan control mosfes (3*IRF4095 arralel)Gate seted wih(2*220R parralel) to+12V //Vape mosfets in supply are controled rom handremote //also some case leds and displaying RX receiver vapepowerset from handremote //use stuff if usefull #include "SPI.h" #include "Adafruit_GFX_AS.h" #include "Adafruit_ILI9341_STM.h" #define TFT_CS PA3 #define TFT_DC PA4//2 #define TFT_RST PA2 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 catx [] = // 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, // # # }; const unsigned char PROGMEM cat [] = { 0xF8, 0x00, 0x00, 0x78, // ##### #### 0xCC, 0x00, 0x01, 0xBC, // ## ## ## #### 0xB3, 0x00, 0x06, 0x24, // # ## ## ## # # 0x99, 0x80, 0x0C, 0xC4, // # ## ## ## ## # 0x8C, 0xC0, 0x31, 0x84, // # ## ## ## ## # 0x84, 0x60, 0x21, 0x04, // # # ## # # # 0x84, 0x20, 0x02, 0x08, // # # # # # 0x84, 0x00, 0x02, 0x08, // # # # # 0x80, 0x00, 0x00, 0x18, // # ## 0xC3, 0x80, 0x0C, 0x10, // ## ### ## # 0x44, 0x40, 0x12, 0x10, // # # # # # # 0x4C, 0x40, 0x31, 0x20, // # ## # ## # # 0x08, 0x60, 0x21, 0x20, // # ## # # # 0x08, 0x20, 0x41, 0x00, // # # # # 0x08, 0x20, 0x41, 0x00, // # # # # 0x00, 0x00, 0x00, 0x00, // 0x00, 0x00, 0x00, 0x00, // 0x07, 0x06, 0x00, 0x00, // ### ## 0x18, 0xCF, 0x0F, 0x80, // ## ## #### ##### 0x61, 0xE6, 0x3C, 0x60, // ## #### ## #### ## 0x86, 0x12, 0x43, 0x10, // # ## # # # ## # 0x18, 0x00, 0x00, 0x80, // ## # 0x20, 0x40, 0x20, 0x40, // # # # # 0x00, 0x84, 0x10, 0x00, // # # # 0x00, 0x8E, 0x20, 0x00, // # ### # 0x00, 0x71, 0xC0, 0x00, // ### ### }; const unsigned char PROGMEM cat2 [] = { 0x3E, 0x00, 0x01, 0xA0, // ##### ## # 0x72, 0x00, 0x02, 0x14, // ### # # # # 0x41, 0x80, 0x0C, 0xC4, // # ## ## ## # 0x4C, 0xC0, 0x11, 0x84, // # ## ## # ## # 0xC4, 0x40, 0x21, 0x04, // ## # # # # # 0x84, 0x20, 0x02, 0x04, // # # # # # 0x84, 0x00, 0x00, 0x04, // # # # 0x83, 0xC0, 0x02, 0x0C, // # #### # ## 0x87, 0xE0, 0x1E, 0x08, // # ###### #### # 0x45, 0xC0, 0x3E, 0x18, // # # ### ##### ## 0x4D, 0xC0, 0x3F, 0x10, // # ## ### ###### # 0x08, 0xA0, 0x27, 0x10, // # # # # ### # 0x00, 0x20, 0x61, 0x30, // # ## # ## 0x0F, 0xC0, 0x71, 0x00, // ###### ### # 0x08, 0x20, 0x1F, 0x00, // # # ##### 0x00, 0x00, 0x03, 0x00, // ## 0x00, 0x06, 0x00, 0x00, // ## 0x15, 0x0F, 0x05, 0x80, // # # # #### # ## 0x60, 0xE7, 0x38, 0x60, // ## ### ### ### ## 0x43, 0x02, 0x42, 0x00, // # ## # # # 0x48, 0x00, 0x00, 0x80, // # # # 0x98, 0x60, 0x60, 0x40, // # ## ## ## # 0x10, 0xC4, 0x30, 0x00, // # ## # ## 0x20, 0x8E, 0x30, 0x00, // # # ### ## 0x00, 0xFB, 0xE0, 0x00, // ##### ##### }; const unsigned char PROGMEM cat3 [] = { 0x1F, 0x00, 0x01, 0xF4, // ##### ##### # 0x36, 0xE0, 0x05, 0x3C, // ## ## ### # # #### 0x23, 0x20, 0x00, 0x64, // # ## # ## # 0x40, 0x98, 0x00, 0x44, // # # ## # # 0x40, 0x48, 0x01, 0x80, // # # # ## 0x40, 0x00, 0x00, 0x04, // # # 0x43, 0xE0, 0x0A, 0x04, // # ##### # # # 0x43, 0xF0, 0x1E, 0x04, // # ###### #### # 0x4E, 0xF0, 0x39, 0x84, // # ### #### ### ## # 0x4B, 0xE0, 0x37, 0x80, // # # ##### ## #### 0x05, 0xF0, 0x2F, 0x8C, // # ##### # ##### ## 0x0F, 0xD0, 0x3B, 0x80, // ###### # ### ### 0x08, 0xF0, 0x27, 0x90, // # #### # #### # 0x08, 0x00, 0x20, 0xA0, // # # # # 0x07, 0xE0, 0x3B, 0x80, // ###### ### ### 0x07, 0x04, 0x00, 0x00, // ### # 0x00, 0x06, 0x00, 0x00, // ## 0x1B, 0x0F, 0x8F, 0x80, // ## ## ##### ##### 0x60, 0xA7, 0x34, 0x60, // ## # # ### ## # ## 0x45, 0x00, 0x03, 0x10, // # # # ## # 0x48, 0x02, 0x00, 0x80, // # # # # 0x98, 0x10, 0x40, 0x40, // # ## # # # 0x10, 0x17, 0x40, 0x00, // # # ### # 0x00, 0x1D, 0xC0, 0x00, // ### ### }; const unsigned char PROGMEM star1 [] = // +5,5, 1,1 { 0x80, // # }; const unsigned char PROGMEM star2 [] = //+4,2,3,3 { 0x40, // # 0xA0, // # # 0x40, // # }; const unsigned char PROGMEM star3 [] = //4,4,3,3 { 0xE0, // ### 0xE0, // ### 0xE0, // ### }; const unsigned char PROGMEM star4 [] = //3,3,5,5 { 0x20, // # 0x00, // 0x88, // # # 0x00, // 0x20, // # }; const unsigned char PROGMEM star5 [] = //2,2,7,7 { 0x10, // # 0x10, // # 0x00, // 0xD6, // ## # ## 0x00, // 0x10, // # 0x10, // # }; const unsigned char PROGMEM star6 [] = //2,2,7,7 { 0x44, // # # 0xC6, // ## ## 0x18, // ## 0x30, // ## 0x20, // # 0xC6, // ## ## 0x44, // # # }; const unsigned char PROGMEM star7 [] = //1,1,9,9 { 0x08, 0x00, // # 0x08, 0x00, // # 0x22, 0x00, // # # 0x1C, 0x00, // ### 0xD3, 0x80, // ## # ### 0x14, 0x00, // # # 0x2A, 0x00, // # # # 0x08, 0x00, // # 0x08, 0x00, // # }; const unsigned char PROGMEM star8 [] = //1,1,10,10 { 0x1C, 0x00, // ### 0x08, 0x00, // # 0x08, 0x00, // # 0x80, 0x80, // # # 0xE9, 0xC0, // ### # ### 0x80, 0x80, // # # 0x00, 0x00, // 0x08, 0x00, // # 0x1C, 0x00, // ### 0x08, 0x00, // # }; const unsigned char PROGMEM star9 [] = //+2,2,7,7 s { 0x10, // # 0x44, // # # 0x00, // 0x82, // # # 0x00, // 0x44, // # # 0x10, // # }; const unsigned char PROGMEM star10 [] = //1,1,10,10 { 0x08, 0x00, // # 0x2A, 0x00, // # # # 0x63, 0x00, // ## ## 0x00, 0x00, // 0xC1, 0x80, // ## ## 0x00, 0x00, // 0x63, 0x00, // ## ## 0x2A, 0x00, // # # # 0x08, 0x00, // # }; const unsigned char PROGMEM star11 [] = // 11,11 { 0x04, 0x00, // # 0x04, 0x00, // # 0x00, 0x00, // 0x00, 0x00, // 0x00, 0x00, // 0xC1, 0x60, // ## # ## 0x00, 0x00, // 0x04, 0x00, // # 0x00, 0x00, // 0x04, 0x00, // # 0x04, 0x00, // # }; //i/os--------- #define t1 PB12 #define t2 PB13 #define t3 PB14 #define t4 PB15 #define t5 PA8 #define t6 PA9 #define rot PC13 #define grun PC14 #define blau PC15 #define npn1 PA10 //fan #define npn2 PB5 //fan #define npn3 PB6 #define npn4 PB7 //blaau 3Watt #define npn5 PB8 //grun 1Watt #define npn6 PB9 //rot 1Watt #define temp1 PB0 //mosfets #define temp2 PB1 //inair #define temp3 PA0 //LDR #define graphsize 135 boolean zeig=true; 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,onpress[18],ende=41,beatsplit,blin; uint16_t messcach[6][graphsize+1],maxx=1000,Mtime=0,tempy1,tempy2,tempy3,meldy[10],correction,fanP=200,fanD=0,oset=0,cattz,colorcount3,zeiger=1; long maintime=millis(),littletime=micros(),slowtime=micros(),tiktak=millis(),setz=micros(); void displaystart(void) {tft.begin(); tft.fillScreen(ILI9341_BLACK); tft.setRotation(1);wuselbitmap(30,50,catx,66,46,0,"vertikal",100,true); textso(11,59,"marderchen",1,0x0fff);textso(14,68,"device =^.^=",1,0xf0ff);} void setup() { pinMode(t1,INPUT);pinMode(t2,INPUT);pinMode(t3,INPUT);pinMode(t4,INPUT);pinMode(t5,INPUT);pinMode(t6,INPUT); pinMode(blau, OUTPUT);pinMode(rot, OUTPUT);pinMode(grun, OUTPUT); pinMode(npn1, OUTPUT);pinMode(npn2, OUTPUT);pinMode(npn3, OUTPUT);pinMode(npn4, OUTPUT);pinMode(npn5, OUTPUT);pinMode(npn6, OUTPUT); Serial3.begin(57600);displaystart(); } void loop() { zeitreise();} void zeitreise(void){ while ((millis()- maintime) >= 8){callOLED();maintime=millis();istinput();} while ((micros()- slowtime)>2000){istwarm();downfade();slowtime = micros();} while ((millis()- tiktak) >= 30){ if(zeiger==0){writegraph();zeigmalher();katze(20,150);} if(zeiger==1){onetime();} if(zeiger>0){zeiger--;allof();} tiktak=millis();} while ((micros()- setz)>(20100/2)){//something between 19500-20500 raw-schneller if (beatsplit >=ende){beatsplit=0;}//schneller=random(2,4)*2; if (beatsplit%10 ==0){meldy[6]=blin*10;} if (beatsplit%10 ==5){meldy[4]=blin*10;} blin++; if(blin>=20){blin=0;} beatsplit++; setz= micros();}//dots here while ((micros()- littletime) >= 200){pulspowder();littletime = micros();}} void istinput(void){onpress[14]++; if (onpress[14] >=2) {onpress[14]=0; if (digitalRead(t1) == HIGH && onpress[0] ==0) {onpress[0]=1;fanP+=10;} if (onpress[0]==1){onpress[1]++;}if(onpress[1]>=10){onpress[1]=0;onpress[0]=0;} if (digitalRead(t2) == HIGH && onpress[2] ==0&&fanP>=10) {onpress[2]=1;fanP-=10;} 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 (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;} 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;} if (onpress[10]==1){onpress[11]++;}if(onpress[11]>=10){onpress[11]=0;onpress[10]=0;} if((digitalRead(t1)||digitalRead(t2)||digitalRead(t3)||digitalRead(t4)||digitalRead(t5)||digitalRead(t6))==HIGH){digitalWrite(blau,HIGH);zeig=true;}else{digitalWrite(blau,LOW);} if(zeig==true){onetime();zeig=false;} }} uint8_t stepz=10; void downfade(void){ for(uint8_t hi=0;hi<6;hi++){ if(meldy[hi]>=stepz){meldy[hi]-=stepz;} if(meldy[hi]>0){meldy[hi]--;}}} void istwarm(void){//no wires to connect temp2, and 3 if (((analogRead(temp1)-2000)) 0){tempy1--;}else{tempy1++;} if (((analogRead(temp2)-2000)) 0){tempy2--;}else{tempy2++;} if (((analogRead(temp3)-2000)) 0){tempy3--;}else{tempy3++;} if(tempy1>200){fanD=fanP+(tempy1-200);}else{fanD=fanP;} } void pulspowder(void) { for (uint16_t fcount=0; fcount <=maxx; fcount++) { if (fcount <= (maxx-1) && fcount >=1) { if (fcount==(maxx-meldy[0])) {digitalWrite(rot,HIGH);} if (fcount==(maxx-meldy[1])) {digitalWrite(grun,HIGH);} if (fcount==(maxx-meldy[2])) {digitalWrite(blau,HIGH);} if (fcount==(maxx-meldy[3])) {digitalWrite(npn3,HIGH);} if (fcount==(maxx-meldy[4])) {digitalWrite(npn4,HIGH);} if (fcount==(maxx-meldy[5])) {digitalWrite(npn5,HIGH);} if (fcount==(maxx-meldy[6])) {digitalWrite(npn6,HIGH);} if (fcount==(maxx-fanD)) {digitalWrite(npn1,HIGH);digitalWrite(npn2,HIGH);} } if (fcount>=maxx){allof();}} } void allof(void){ digitalWrite(rot,LOW);digitalWrite(rot,LOW);digitalWrite(grun,LOW);digitalWrite(npn1,LOW);digitalWrite(npn2,LOW);digitalWrite(npn3,LOW);digitalWrite(npn4,LOW);digitalWrite(npn5,LOW);digitalWrite(npn6,LOW);} uint8_t swaps=0; void writegraph(void){ messcach[0][graphsize]=tempy1; messcach[1][graphsize]=tempy2; messcach[2][graphsize]=fanD; messcach[3][graphsize]=tempy3; for(uint8_t rutsch=0;rutschwoo2){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]/teilstel,0x000f);tft.drawPixel(dar,woo+hoch-messcach[0][dar-woo2]/teilstel,0xf00f);tft.drawPixel(dar,woo+hoch-messcach[1][dar-woo2]/teilstel,0x0ff0);tft.drawPixel(dar,woo+hoch-messcach[3][dar-woo2]/teilstel,0xf000);} hier=woo+hoch-tempy1/teilstel;hierauch=woo+hoch-tempy2/teilstel;hierauchi=woo+hoch-tempy3/teilstel;hierf=woo+hoch-fanD/teilstel; 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.drawFastVLine(weg,hierauchi-5,12,0x0000);} tft.drawFastHLine(woo2+graphsize,hierf,5,0x000f); textso(woo2+graphsize+6,hierf-3,String(round(fanD/scaler))+"%",1,0x000f); tft.drawFastHLine(woo2+graphsize,hier,5,0xffff); textso(woo2+graphsize+6,hier-3,String(round(tempy1/scaler))+"C",1,0xffff); tft.drawFastHLine(woo2+graphsize,hierauch,5,0xffff); textso(woo2+graphsize+6,hierauch-3,String(round(tempy2/scaler))+"C",1,0xffff); tft.drawFastHLine(woo2+graphsize,hierauchi,5,0xf000); textso(woo2+graphsize+6,hierauchi-3,String(round(tempy3/scaler))+"L",1,0xf000); 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+22,hoch+30,tft.color565(r,g,b)); colory(rainbow[128-dieda]); tft.drawRect(woo2-1,woo-19,graphsize+mehr+20,hoch+28,tft.color565(r,g,b)); tft.drawFastHLine(woo2+48,woo+4,74,tft.color565(r,g,b)); } //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 katze(uint16_t x,uint16_t y){ cattz++; colorcount3 +=2; colory(rainbow[colorcount3]); if (cattz == 1) {tft.drawBitmap(x,y, cat,30, 26, tft.color565(r,g,b));} if (cattz == 2) {tft.drawBitmap(x,y+1, cat2,30, 25, tft.color565(r,g,b));} if (cattz == 3) {tft.drawBitmap(x,y+2, cat3,30, 24, tft.color565(r,g,b));} if (cattz == 4) {tft.drawBitmap(x,y+1, cat2,30, 25, tft.color565(r,g,b));} if (cattz == 5) {cattz = 0;} if (colorcount3 >= 127) {colorcount3=0;} } void colory(uint32_t colorz) { String hexcolor = String(colorz); int number = hexcolor.toInt(); r = number >> 16; g = number >> 8 & 0xFF; b = number & 0xFF;} String cachb=""; String cach=""; void callOLED(void) { while(Serial3.available()>0) { int cachs = Serial3.read(); cachb = ""; cachb += (char)cachs; if (isDigit(cachs)) { cach += (char)cachs;} if ( cachb == "v") { oset =cach.toInt(); zeiger=30;meldy[0]=maxx; tft.setTextSize(3); tft.setCursor(0,20); colory(0xffffff); tft.setTextColor(tft.color565(r,g,b)); tft.fillRect(0,0,200,100, 0x0000); tft.print("MEOWz =^.^=\n Incomming! \n vape duty:\n \n "); colory(0xff205b); tft.fillRect(0,100,200,70, tft.color565(r,g,b)); tft.setTextSize(6); if(oset<10){tft.print("0");}if(oset<100){tft.print("0");}//if(oset<1000){tft.print("0");} tft.print(String(oset)); tft.print("%"); cach =""; cachb =""; }}} /* * MEOW! STM32 program (main actions) * by marderchen =^.^= working fine but currently uses 32/65Kbyte cach from STM32F103C8T6 so enough place for bitmapsdata, better font,...) * do what you want! * ___ * _.-| | / |\__/,| (`\ { | | -- |^ ^ |__ _) ) "-.|___| \ _.( Y ) ` / .--'-`-. _((_ `^--' /__< \ ....-+|______|__.-||__)`-' (((/ (((/ CATS are awesome! */