lor //board STM32F103C9T6 (64Kb 72Mhz) || tft: ILI9340C (240x320pixel 2,2" 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 #include "SPI.h" #include "Adafruit_GFX_AS.h" #include "Adafruit_ILI9341_STM.h" #define TFT_CS PA0 #define TFT_DC PA2 #define TFT_RST PA1 Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); // Use hardware SPI 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, // # }; #define NUMFLAKES3 140 #define NUMFLAKES4 140 #define NUMFLAKES5 120 //i/os--------- #define ca1 PB15 #define ca2 PB14 #define ca3 PB13 #define ca4 PB12 #define vape PA8 #define rot PB11 #define grun PA10 #define blau PB10 #define heat PA9 //#define temp PB0 //tisch #define sw1 PB0 //tisch #define sw2 PB0 //tisch #define sw3 PB0 //tisch //anizeugs int nyans1 =2; int cats33 =5; int nyansc1 =0; int nyanc1 =0; int nyanc2 =0; int nyanc3 =0; int nyand1 =0; int nyand2 =0; int cats2 =70; int stary1 = 7; int stary2 = 0; int starc1 = 0; int stars1 = 40; int stars1b = 40; int starposy =0; int starposx =100; int star2posy =0; int star2posx =100; long color =0; long colorc =0; int g = 0; int f1 = 0; uint8_t starys[NUMFLAKES5][52]; uint8_t starys2[NUMFLAKES5][52]; int rainbow [] ={0xFF0000,0xFF1900,0xFF3200,0xFF4B00,0xFF6400,0xFF7D00,0xFF9600,0xFFAF00,0xFFC800,0xFFE100,0xFFFA00,0xEAFF00,0xD1FF00,0xB7FF00,0x9EFF00,0x85FF00,0x6CFF00,0x53FF00,0x3AFF00,0x21FF00,0x08FF00,0x00FF10,0x00FF29,0x00FF42,0x00FF5B,0x00FF75,0x00FF8E,0x00FFA7,0x00FFC0,0x00FFD9,0x00FFF2,0x00F2FF,0x00D9FF,0x00C0FF,0x00A7FF,0x008EFF,0x0075FF,0x005BFF,0x0042FF,0x0029FF,0x0010FF,0x0800FF,0x2100FF,0x3A00FF,0x5300FF,0x6C00FF,0x8500FF,0x9E00FF,0xB700FF,0xD100FF,0xEA00FF,0xFF00FA,0xFF00E1,0xFF00C8,0xFF00AF,0xFF0096,0xFF007D,0xFF0064,0xFF004B,0xFF0032,0xFF0019}; int rgb [] ={0xFF0000,0xFFFF00,0x00FFFF,0x0000FF,0xFF00FF}; int rgb2 [] ={ 16711680,16776960, 4095, 255,16711935}; int rgb3 [] ={0x000000,0xF8E000,0x08FCF8,0x001CF8,0x001CF8}; //------------------- long colorcount1 =0; // rectagle65535 long colorcount2 =0; //text long colorcount3 =0; //kleincat long colorcount4 =0; //text long colorcount5 =0; //rect long colorcount6 =0; //pfeil long colorcount7 =0; //rauschen long colorcount8 =0; //rauchen2 long colorcount9 =0; long colorcount10 =0; long colorcounta1 =0; long colorcounta2 =1000; long colorcounta3 =2000; long colorcounta4 =3000; long colorcountv1 =0; long colorcountv2 =0; //rect color int speedy =200; int blcount =0; //ende anizeugs int clinks = 0; int prozi =0; int woo = 80; int wooo = 0; int woooo = 0; int wis = 0; int bb = 0; int rr = 0; int gg = 0; int heatt =0; int c2 =0; int c1 =0; int c4 =0; int c3 =0; int sets =1; int sets1 =0; int sets2 =25; int sets3 =50; int sets4 =75; int sets5 =100; int barb = 21; int count0 =10; int count1 =0; int count2 =0; int count3 =0; int count4 =0; int count5 =0; int count6 =0; int count7 =5; int count8 =0; int dutyaus = 0; int dutytime = 0; int watt1 = 0; int watt2 =0; int boost =0; int nyanon =0; int standy =0; int nyancounter =0; int catcounter =0; int cattz = 0; long fcount = micros(); int tempy = 0; int gcount =0; int rcount =0; int bcount =0; int cofcount=1; int concount=1; int standymode; int standydelay; int lamp =0; int cpcounter=0; int cp2=0; int rheiz=0; long allfcount = micros(); int fcount1; int duty1=0; int duty2=0; int duty3=0; int RGB =0; int lights =00; int rainbowt=0; int light=0; int darkness=0; int downtimer=0; //uhrzeugs int globAlmCnt = 0; int globOvCnt = 0; int globSecCnt = 0; int specAlmCnt = 0; int lastGlobAlmCnt = -1; int lastSpecAlmCnt = -1; int q =0; int x =0; int schneezahl =4096; int schneezahl2 =1; int menge =20; int menge1 =0; int achsex =0; int achsey =0; void setup() { tft.begin(); tft.fillScreen(ILI9341_BLACK); tft.setRotation(0); pinMode(ca1, INPUT); pinMode(ca2, INPUT); pinMode(ca3, INPUT); pinMode(ca4, INPUT); pinMode(vape, INPUT); pinMode(blau, OUTPUT); pinMode(rot, OUTPUT); pinMode(grun, OUTPUT); pinMode(heat, OUTPUT); /* * rtc_init(RTCSEL_LSI); rtc_set_prescaler_load(0x7fff); rtc_set_count(0); rtc_attach_interrupt(RTC_SECONDS_INTERRUPT, rtc_sec_intr); rtc_attach_interrupt(RTC_OVERFLOW_INTERRUPT, rtc_ovf_intr); // expected every 128000 seconds rtc_attach_interrupt(RTC_ALARM_GLOBAL_INTERRUPT, rtc_glob_alm_intr); rtc_attach_interrupt(RTC_ALARM_SPECIFIC_INTERRUPT, rtc_spec_alm_intr); */ for (uint8_t g=0; g< stars1; g++) { starys[g][starposy] =100;// random(45,90) ; starys[g][starposx] =random(110,130); starys2[g][starposy] =100;// random(45,90) ; starys2[g][starposx] =random(110,130); } } void loop() { if (digitalRead(vape) == HIGH) { heatt =2;} if (digitalRead(vape) == LOW) { heatt =0;} if (digitalRead(ca2) == HIGH) { c2 =2;} if (digitalRead(ca2) == LOW) { c2 =0;} if (digitalRead(ca1) == HIGH) { c4 =2;} if (digitalRead(ca1) == LOW) { c4 =0;} if (digitalRead(ca4) == HIGH) { c1 =2;} if (digitalRead(ca4) == LOW) { c1 =0;} if (digitalRead(ca3) == HIGH) { c3 =2;} if (digitalRead(ca3) == LOW) { c3 =0;} if (heatt == 0) { tft.fillScreen(ILI9341_BLACK); digitalWrite(heat, LOW ); standy = 2; //if (lamp == 0) {noc(); standydelay++; if (standydelay ==2) { digitalWrite(rot, LOW); digitalWrite(grun, LOW); } if (rr == 0) { digitalWrite(rot, LOW);} if (rr == 1) { digitalWrite(rot, HIGH);} if (bb == 0) { digitalWrite(blau, LOW);} if (bb == 1) { digitalWrite(blau, HIGH);} if (gg == 0) { digitalWrite(grun, LOW);} if (gg == 1) { digitalWrite(grun, HIGH);} if (standydelay >=300) {c3 =2; standydelay =0;} count5 =0; //uhr /*zeugs* * time rtc_get_count() * Serial.print(globAlmCnt); Serial.print(rtc_get_divider()); Serial.print(globSecCnt); Serial.print(globOvCnt); Serial.print(globAlmCnt); Serial.print(specAlmCnt); if ((lastSpecAlmCnt != specAlmCnt) || (lastGlobAlmCnt != globAlmCnt)){ Serial.println(" -- alarm -- "); for (i=0;i<3;i++) { digitalWrite(BOARD_LED_PIN, 0); delay(100); digitalWrite(BOARD_LED_PIN, 1); delay(100);} n = rtc_get_count() + 5; rtc_set_alarm(n); } lastGlobAlmCnt = globAlmCnt; lastSpecAlmCnt = specAlmCnt; */ if (standymode == 5) {standymode =0;} // settuings if (count0 > 1 ) { count0--; } if (count0 <= 1 && c2 == 2) {sets++; count0 =10;} if (count3 > 1 ) { count3--;} if (sets == 0) {sw(); prozi =sets1; wooo =0; bar(); if (c1 ==2 && prozi <= 98 && count3 <= 1) {sw(); sets1++; pfl(); count3 =10; setc(); standymode++;} if (c4 ==2 && prozi > 0 && count3 <= 1) {sw(); sets1--; pfr(); count3 =10; setc(); }} if (sets == 1) {sw(); prozi = sets2; wooo =10; bar(); if (c1 ==2 && prozi <= 98 && count3 <= 1) {sw(); sets2++; pfl(); count3 =5; setc();} if (c4 ==2 && prozi > 10 && count3 <= 1) {sw(); sets2--; pfr(); count3 =5; setc();}} if (sets == 2) {sw(); prozi = sets3; wooo =21; bar(); if (c1 ==2 && prozi <= 98 && count3 <= 1) {sw(); sets3++; pfl(); count3 =5; setc();} if (c4 ==2 && prozi > 10 && count3 <= 1) {sw(); sets3--; pfr(); count3 =5; setc();}} if (sets == 3) {sw(); prozi = sets4; wooo =32; bar(); if (c1 ==2 && prozi <= 98 && count3 <= 1) {sw(); sets4++; pfl(); count3 =5; setc();} if (c4 ==2 && prozi > 10 && count3 <= 1) {sw(); sets4--; pfr(); count3 =5; setc();}} if (sets == 4) {sw(); prozi = sets5; wooo =43; bar(); if (c1 ==2 && prozi < 150 && count3 <= 1) {sw(); sets5++; pfl(); bar(); count3 =2; setc();} if (c4 ==2 && prozi > 10 && count3 <= 1) {sw(); sets5--; pfr(); count3 =2; setc();}} if (sets == 5) {sets =0;} if (c1 ==0 && lamp ==0) {noc();} //taschenlampe //blitzsingle if (c1 ==2) {rcount++; concount=1; cofcount=1; standydelay =0;} if (c4 ==2) {gcount++;concount=1; cofcount=1; standydelay =0;} if (c2 ==2) {bcount++;concount=1; cofcount=1; standydelay =0;} if (c3 ==2) {bcount++;} //akudampfe only if (rcount >=1 && rcount <=(concount +1)) {rcount++; rr=1;} if (rcount >=(concount+2) && rcount <=(concount+cofcount +3)) {rcount++; rr=0;} if (rcount >=(concount+cofcount +4)) {rcount=0;} if (bcount >=1 && bcount <=(concount +1)) {bcount++; bb=1;} if (bcount >=(concount+2) && bcount <=(concount+cofcount +3)) {bcount++; bb=0;} if (bcount >=(concount+cofcount +4)) {bcount=0;} if (gcount >=1 && gcount <=(concount +1)) {gcount++; gg=1;} if (gcount >=(concount+2) && gcount <=(concount+cofcount +3)) {gcount++; gg=0;} if (gcount >=(concount+cofcount +4)) {gcount=0;} //heizen+blink if (heatt == 0) {count2 =0;} if (count2 <= 31 && heatt ==2) {count2++; count4++;} zeigmal(); if (prozi >= 0 && prozi <= 9) {woo = 147;} if (prozi >= 100) {woo = 105;} if (prozi < 100 && prozi >= 10) {woo = 126;} } if (heatt == 2) { cpcounter=0; dampf(); } } //endloop //platzsparfunktionenhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh void setlights(void){ while ((micros()-allfcount) >= 10) { fcount1++; if (fcount1 == (151-duty1)) { digitalWrite(rot, HIGH );} if (fcount1 == (151-duty2)) { digitalWrite(grun, HIGH );} if (fcount1 == (151-duty3)) { digitalWrite(blau, HIGH );} if (fcount1 >= 153) {digitalWrite(rot, LOW ); digitalWrite(blau, LOW ); digitalWrite(grun, LOW ); fcount1 = 0;} // rainbowt++; //if (rainbowt >=300) { RGB++; rgbcalc(); rainbowt=0; } allfcount = micros(); }} void dampf(void){ dutyaus=prozi; //rgbcalc(); light =150; while ((micros()-allfcount) >= 10) { fcount1++; if (fcount1 == (151-duty1)) { digitalWrite(rot, HIGH );} if (fcount1 == (151-duty2)) { digitalWrite(grun, HIGH );} if (fcount1 == (151-duty3)) { digitalWrite(blau, HIGH );} if (fcount1 == (151-dutyaus)) { digitalWrite(heat, HIGH );} if (fcount1 >= 153) {digitalWrite(rot, LOW ); digitalWrite(blau, LOW ); digitalWrite(grun, LOW ); digitalWrite(heat, LOW ); fcount1 = 0;} rainbowt++; if (rainbowt >= (2* (150-prozi))) { RGB++; rgbcalc(); rainbowt=0; } allfcount = micros(); }} void proziact(void) { count7++; } void setc(void) { //count8 =0; if (prozi >= 80) { digitalWrite(rot, HIGH); } if (prozi <= 79) { digitalWrite(rot, LOW); } if (prozi >= 90) { digitalWrite(blau, HIGH); } if (prozi <= 89) { digitalWrite(blau, LOW); } if (prozi <= 49) { digitalWrite(grun, HIGH); } if (prozi >= 50) { digitalWrite(grun, LOW); } } void noc(void) { if (count8 == 3) { digitalWrite(blau, LOW); digitalWrite(grun, LOW); digitalWrite(rot, LOW); } } void rgbcalc(void) { if (light > 150) {darkness =0; lights = light -150;} if (light < 150) {darkness =light; lights =0;} if(RGB >=0 && RGB <=150) {duty1 =150 -darkness; duty2 =RGB + lights; duty3 =0 + lights;} //rot ->gelb (rotmax grün+ blau0) if(RGB >=151 && RGB <=301) {duty1 =150 -(RGB -151) +lights; duty2 =150 -darkness; duty3 =0 +lights;} //gelb ->grün (rot- grünmax blau0) if(RGB >=302 && RGB <=452) {duty1 =0+lights; duty2 =150 -darkness; duty3 =(RGB - 302) + lights;} //grün ->cyan (rot0 grünmax blau+) if(RGB >=453 && RGB <=603) {duty1 =0+lights; duty2 =150 -(RGB - 453) +lights; duty3 =150 -darkness;} //cyan ->blau (rot0 grün- blaumax) if(RGB >=604 && RGB <=754) {duty1 =(RGB-604) +lights; duty2 =0 +lights; duty3 =150 -darkness;} //blau ->lila (rot+ grün0 blaumax) if(RGB >=755 && RGB <=905) {duty1 =150 -darkness; duty2 =0+lights; duty3 =150- (RGB -756) +lights;} //lila ->rot (rotmax grün0 blau-) if(RGB >= 906) {RGB=0;} } int tspedy =0; int rhc =45; int rwc =210; void zeigmal(void) { tspedy++; // speedy =1; speedy =random(3,12); if (speedy >= 62) {speedy=0;} colorcounta1 +=speedy; colorcounta2 +=speedy+ random(1,3); colorcounta3 +=speedy + random(2,4); colorcounta4 +=speedy + random(3,5); /* * if (speedy >= 40500) {speedy=0;} colorcounta1 =speedy; colorcounta2 =speedy+ random(5000,15000); colorcounta3 =speedy + random(10000,20000); colorcounta4 =speedy + random(15000,25000); */ colorcountv1 += 500; colorcount2 +=3000; colorcount5 +=530; colorcount4 +=510; if (colorcounta1 >= 61) { colorcounta1 =0;} if (colorcounta2 >= 61) { colorcounta2 =0;} if (colorcounta3 >= 61) { colorcounta3 =0;} if (colorcounta4 >= 61) { colorcounta4 =0;} if (colorcountv1 >= 65535) { colorcountv1 =0;} /* if (colorcounta1 >= 65535) { colorcounta1 =0;} if (colorcounta2 >= 65535) { colorcounta2 =0;} if (colorcounta3 >= 65535) { colorcounta3 =0;} if (colorcounta4 >= 65535) { colorcounta4 =0;} if (colorcountv1 >= 65535) { colorcountv1 =0;} */ if (c4 == 0) { tft.drawRect(4, 4, 52, 18, rainbow[colorcounta1]); tft.setTextSize(2); tft.setCursor(25,6); tft.setTextColor(rainbow[colorcounta1]); tft.println("-"); } if (c4 == 2) { tft.drawRect(0, 0, 60, 28, rainbow[colorcounta1]); tft.setTextSize(4); tft.setCursor(20,0); tft.setTextColor(rainbow[colorcounta1]); tft.println("-"); } if (c2 == 0) { tft.drawRect(64, 4, 52, 18, rainbow[colorcounta2]); tft.setTextSize(2); tft.setCursor(72,6); tft.setTextColor(rainbow[colorcounta2]); tft.println("set"); } if (c2 == 2) { tft.drawRect(60, 0, 60, 28, rainbow[colorcounta2]); tft.setTextSize(3); tft.setCursor(63,2); tft.setTextColor(rainbow[colorcounta2]); tft.println("set"); } if (c3 == 0) { tft.drawRect(124, 4, 52, 18, rainbow[colorcounta3]); tft.setTextSize(2); tft.setCursor(145,6); tft.setTextColor(rainbow[colorcounta3]); tft.println("?"); } if (c3 == 2) { tft.drawRect(120, 0, 60, 28, rainbow[colorcounta3]); tft.setTextSize(4); tft.setCursor(141,2); tft.setTextColor(rainbow[colorcounta3]); tft.println("?"); } if (c1 == 0) { tft.drawRect(184, 4, 52, 18, rainbow[colorcounta4]); tft.setTextSize(2); tft.setCursor(205,6); tft.setTextColor(rainbow[colorcounta4]); tft.println("+"); } if (c1 == 2) { tft.drawRect(180, 0, 60, 28, rainbow[colorcounta4]); tft.setTextSize(4); tft.setCursor(201,2); tft.setTextColor(rainbow[colorcounta4]); tft.println("+"); } tft.setTextSize(1); tft.setCursor(0,294); tft.println("150 = 1300Watt (!)"); tft.setCursor(0,302); tft.println("better not try DOOM"); tft.setTextSize(3); tft.setCursor(0,270); tft.setTextColor(colorcount2); if (prozi <=9) {tft.println("POWER:");} if (prozi >=10 && prozi <=99) {tft.println("POWER:");} if (prozi >=100) {tft.println("POWER:");} tft.setTextSize(5); tft.setCursor(woo,270); tft.println(prozi); tft.setCursor(188,270); tft.println("%"); tft.setTextSize(1); tft.setCursor(0,8); tft.setTextSize(1); tft.setCursor(210,rhc+(210 -(prozi*1.3333+8))); tft.setTextColor(rainbow[colorcounta2]); if (prozi <=99) {tft.print(" ");} if (prozi <=9) {tft.print(" ");} tft.println(prozi); rainbowRect ( rwc,rhc+210 -prozi*1.3333,24,prozi*1.3333); tft.setCursor(210,rhc+210); tft.setTextColor(rainbow[colorcounta2]); tft.println("LOAD"); tft.setTextSize(1); tft.setCursor(63,241); tft.println("MEOW POWER STATION"); /* x234 x210 y45 y120 */ cattz++; colorcount3 +=20; if (cattz == 1) {tft.drawBitmap(102,50, cat,30, 26, colorcount3);} if (cattz == 2) {tft.drawBitmap(102,50+1, cat2,30, 25, colorcount3);} if (cattz == 3) {tft.drawBitmap(102,50+2, cat3,30, 24, colorcount3);} if (cattz == 4) {tft.drawBitmap(102,50+1, cat2,30, 25, colorcount3);} if (cattz == 5) {cattz = 0;} if (colorcount3 >= 65535) {colorcount3=1;} tft.drawLine(184, 115, 146, 83, colorcountv1); tft.drawLine(49, 115, 88, 83, colorcountv1); tft.drawLine(49, 234, 184, 234, colorcountv1); tft.drawRect(49, 115, 135, 140, colorcountv1); //unmteres tft.drawRect(88, 40, 57, 43, colorcountv1); //oberes tft.drawCircle(73, 175, 5, colorcountv1); tft.drawCircle(160, 175, 5, colorcountv1); drawMLine(155, 175, 136, 148, colorcountv1); //coil drawMLine(117, 191, 136, 148, colorcountv1); drawMLine(98, 148, 117, 191, colorcountv1); drawMLine(78, 175, 98, 148, colorcountv1); //grissel // if (menge1 <=5) { if (schneezahl2 ==1) { for (uint8_t x1=0; x1< 135; x1++) { for (uint8_t q1=0; q1< menge; q1++) { achsex =random(50,183); if ((achsex % 2) == 0 && (achsey % 2) ==0) { tft.drawPixel(achsex, achsey, colorcount7); } if ((achsex % 2) == 1 && (achsey % 2) ==1) { tft.drawPixel(achsex, achsey, colorcount7); colorcount7 +=random(29,140);} if (colorcount7 >= 65535) {colorcount7=1;} } achsey++; if (achsey >= 233) {achsey = 116;}} } if (schneezahl2 ==2) { for (uint8_t x1=0; x1< 64; x1++) { for (uint8_t q1=0; q1< menge; q1++) { achsex =random(50,183); if ((achsex % 2) == 1 && (achsey % 2) ==0) { tft.drawPixel(achsex, achsey, colorcount8); } if ((achsex % 2) == 1 && (achsey % 2) ==1) { tft.drawPixel(achsex, achsey, colorcount8); colorcount7 +=random(13,39); } if (colorcount7 >= 65535) {colorcount8=1;} } achsey++; if (achsey >= 233) {achsey = 116;}} } schneezahl2++; if (schneezahl2== 3) {schneezahl2 = 1;} menge1++; menge = prozi/4; for (uint8_t g=0; g< stars1; g++) { starc1++; starys[g][starposy] *= 0.97; starys[g][starposy] -= random(1,3); if (starys[g][starposy] < 10) { starys[g][starposy] =random(183.200);//(45,80) ; starys[g][starposx] =random(50,140); } if (starys[g][starposy] >=70) { if (starys[g][starposx] >=110) {starys[g][starposx] -=random(0,3);} if (starys[g][starposx] <=110) {starys[g][starposx] +=random(0,3);} } if (starys[g][starposy] >=90 && starys[g][starposy] <=99) { if (starys[g][starposx] >=110) {starys[g][starposx] -=random(17,18);} if (starys[g][starposx] <=110) {starys[g][starposx] +=random(17,18);} } if (starys[g][starposy] <=99 && starys[g][starposy] >=72 ) { if (starys[g][starposx] >=110) {starys[g][starposx] -=random(0,3);} if (starys[g][starposx] <=110) {starys[g][starposx] +=random(0,3);} } if (starys[g][starposy] <=80) { if (starys[g][starposx] >=110) {starys[g][starposx] +=random(-1,2);} if (starys[g][starposx] <=110) {starys[g][starposx] -=random(-1,2);} } if (starys[g][starposy] <=60) { if (starys[g][starposx] >=110) {starys[g][starposx] +=random(-5,8);} if (starys[g][starposx] <=110) {starys[g][starposx] -=random(-5,8);} } if (starys[g][starposy] >=83 && starys2[g][star2posy] <=40 && starys[g][starposx] <= 88) { starys[g][starposx] =rando if (starc1 == 1) { tft.drawBitmap((starys2[g][star2posx]) +5, (starys2[g][star2posy]) +5, star1,1, 1, (long) random(65535)); } if (starc1 == 2) { tft.drawBitmap((starys2[g][star2posx]) +4, (starys2[g][star2posy]) +4, star2,3, 3, (long) random(65535)); } if (starc1 == 3) { tft.drawBitmap((starys2[g][star2posx]) +4, (starys2[g][star2posy]) +4, star3,3, 3, (long) random(65535)); } if (starc1 == 4) { tft.drawBitmap((starys2[g][star2posx]) +3, (starys2[g][star2posy]) +3, star4,5, 5, (long) random(65535)); } if (starc1 == 5) { tft.drawBitmap((starys2[g][star2posx]) +2, (starys2[g][star2posy]) +2, star5,7, 7, (long) random(65535)); } if (starc1 == 6) { tft.drawBitmap((starys2[g][star2posx]) +2, (starys2[g][star2posy]) +2, star6,7, 7, (long) random(65535)); } if (starc1 == 7) { tft.drawBitmap((starys2[g][star2posx]) +1, (starys2[g][star2posy]) +1, star7,9, 9, (long) random(65535)); } if (starc1 == 8) { tft.drawBitmap((starys2[g][star2posx]) +1, (starys2[g][star2posy]) +1, star8,10, 10, (long) random(65535)); } if (starc1 == 9) { tft.drawBitmap((starys2[g][star2posx]) +2, (starys2[g][star2posy]) +2, star9,7, 7, (long) random(65535)); } if (starc1 == 10) { tft.drawBitmap((starys2[g][star2posx]) +1, (starys2[g][star2posy]) +1, star10,10, 10, (long) random(65535)); } if (starc1 == 11) { tft.drawBitmap((starys2[g][star2posx]), (starys2[g][star2posy]), star11,11, 11, (long) random(65535)); } // if (starc1 == 7) { starc1 = 1; } starys2[g][star2posy] *= 0.97; starys2[g][star2posy] -= random(1,3); if (starys2[g][star2posy] < 10) { starys2[g][star2posy] =random(183.200);//(45,80) ; starys2[g][star2posx] =random(70,140); } if (starys2[g][star2posy] >=70) {n if (starys2[g][star2posx] >=110) {starys2[g][star2posx] -=random(-2,4);} if (starys2[g][star2posx] <=110) {starys2[g][star2posx] +=random(-2,4);} } if (starys2[g][star2posy] >=90 && starys2[g][star2posy] <=99) { if (starys2[g][star2posx] >=110) {starys2[g][star2posx] -=random(17,28);} if (starys2[g][star2posx] <=110) {starys2[g][star2posx] +=random(17,28);} } if (starys2[g][star2posy] <=30) { if (starys2[g][star2posx] >=110) {starys2[g][star2posx] +=random(0,4);} if (starys2[g][star2posx] <=110) {starys2[g][star2posx] -=random(0,3);} } if (starys2[g][star2posy] <=60) { if (starys2[g][star2posx] >=110) {starys2[g][star2posx] +=random(-1,3);} if (starys2[g][star2posx] <=110) {starys2[g][star2posx] -=random(-1,3);} } if (starys2[g][star2posy] <=50) { if (starys2[g][star2posx] >=110) {starys2[g][star2posx] +=random(-5,8);} if (starys2[g][star2posx] <=110) {starys2[g][star2posx] -=random(-5,8);} } if (starys2[g][star2posy] >=83 && starys2[g][star2posy] <=40 && starys2[g][star2posx] <= 88) { starys2[g][star2posx] =random(89,135);} if (starys2[g][star2posy] >=83 && starys2[g][star2posy] <=40 && starys2[g][star2posx] >= 136) { starys2[g][star2posx] =random(89,135);} if (starc1 == 1) { tft.drawBitmap((starys2[g][star2posx]) +5, (starys2[g][star2posy]) +5, star1,1, 1, (long) random(65535)); } if (starc1 == 2) { tft.drawBitmap((starys2[g][star2posx]) +4, (starys2[g][star2posy]) +4, star2,3, 3, (long) random(65535)); } if (starc1 == 3) { tft.drawBitmap((starys2[g][star2posx]) +4, (starys2[g][star2posy]) +4, star3,3, 3, (long) random(65535)); } if (starc1 == 4) { tft.drawBitmap((starys2[g][star2posx]) +3, (starys2[g][star2posy]) +3, star4,5, 5, (long) random(65535)); } if (starc1 == 5) { tft.drawBitmap((starys2[g][star2posx]) +2, (starys2[g][star2posy]) +2, star5,7, 7, (long) random(65535)); } if (starc1 == 6) { tft.drawBitmap((starys2[g][star2posx]) +2, (starys2[g][star2posy]) +2, star6,7, 7, (long) random(65535)); } if (starc1 == 7) { tft.drawBitmap((starys2[g][star2posx]) +1, (starys2[g][star2posy]) +1, star7,9, 9, (long) random(65535)); } if (starc1 == 8) { tft.drawBitmap((starys2[g][star2posx]) +1, (starys2[g][star2posy]) +1, star8,10, 10, (long) random(65535)); } if (starc1 == 9) { tft.drawBitmap((starys2[g][star2posx]) +2, (starys2[g][star2posy]) +2, star9,7, 7, (long) random(65535)); } if (starc1 == 10) { tft.drawBitmap((starys2[g][star2posx]) +1, (starys2[g][star2posy]) +1, star10,10, 10, (long) random(65535)); } if (starc1 == 11) { tft.drawBitmap((starys2[g][star2posx]), (starys2[g][star2posy]), star11,11, 11, (long) random(65535)); } if (starc1 == 12) { starc1 = 1; } } } int hoh =55; int widi=2; int rgbc =0; void bar(void){ tft.setTextColor(colorcount4); tft.setTextSize(1); tft.setCursor(widi,hoh); if (sets1 <=8) {tft.print(" ");} tft.print(" "); tft.print(sets1); tft.print("%"); tft.setCursor(widi,hoh +11); tft.print(" "); tft.print(sets2); tft.print("%"); tft.setCursor(widi,hoh +22); tft.print(" "); tft.print(sets3); tft.print("%"); tft.setCursor(widi,hoh +33); tft.print(" "); tft.print(sets4); tft.print("%"); tft.setCursor(widi,hoh +44); if (sets5 <=99) {tft.print(" ");} //if (sets5 == 100) { tft.print(" ");} tft.print(sets5); tft.print("%"); // if (prozi >= 100 && sets ==4) {barb =27; } // if (prozi <=99) {barb =21;} // if (sets == 4 && prozi <= 99) {wooo = 102;} tft.drawRect(widi-2, (hoh +wooo)-1, 27, 11, colorcount5); tft.drawRect(32, 0, 96, 34, colorcount8); //ramen x,y,w,h tft.setTextColor(colorcount9); tft.setTextSize(4); tft.setCursor(103,3); tft.println("%"); //tft.println(0xDEADBEEF, HEX); tft.setTextSize(1); tft.setTextColor(colorcount10); tft.setCursor(0,45); tft.println("0%^^^^^^^50%^^^^^100%"); tft.fillRect(prozi / 0.875, 38, 14, 5, colorcount1); tft.setTextSize(4); } void pfl(void){ tft.setTextSize(1); tft.setTextColor(colorcount6); tft.setCursor(prozi / 0.875 +8,37); tft.println("->"); } void pfr(void){ tft.setTextSize(1); tft.setTextColor(colorcount6); tft.setCursor(prozi / 0.875 -6,37); tft.println("<-"); } void sw(void) { // tft.fillScreen(ILI9341_BLACK); } int rgbdlm =0; int x10=0; long leinmovcolor =0; void drawMLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) { 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); x10=x0; int16_t err = dx / 2; int16_t err2 = dx / 2; int y10 =y0; int16_t ystep; if (y0 < y1) { ystep = 1; } else { ystep = -1; } for (; x0<=x1; x0++) { /* leinmovcolor +=random(29,31); //leinmovcolor +=prozi *1; if (leinmovcolor >= 65535) { leinmovcolor =0;} if (steep) { tft.drawPixel(y0, x0, leinmovcolor); } else { tft.drawPixel(x0, y0, leinmovcolor); }*/ leinmovcolor +=random(29,31); //leinmovcolor +=prozi *1; if (leinmovcolor >= 16711935) { leinmovcolor =0;} if (steep) { tft.drawPixel(y0, x0, leinmovcolor); } else { tft.drawPixel(x0, y0, leinmovcolor); } err -= dy; if (err < 0) { y0 += ystep; err += dx; } } for (; x10<=x1; x10++) { // if (x10 % random(5,10)==1){ rgbc +=1; //leinmovcolor +=prozi *1; if (rgbc >= 5) {rgbc =0;} if (steep) { tft.drawPixel(y10 +random(-3,3), x10+random(-3,5), rgb2[rgbc]); } else { tft.drawPixel(x10+random(-3,3), y10+random(-3,3), rgb2[rgbc]); } err2 -= dy; if (err2 < 0) { y10 += ystep; err2 += dx; } } } void rainbowRect(int16_t x, int16_t y, int16_t w, int16_t h) { for (int16_t i=y; i=65535) { colorcountv2 =0;} } } /* * MEOW! STM32 program (main actions) * currently controling 1300Watt DC power and RGB leds (+display+capacitive +taster() * do what you want! * ___ * _.-| | / |\__/,| (`\ { | | -- |^ ^ |__ _) ) "-.|___| \ _.( Y ) ` / .--'-`-. _((_ `^--' /__< \ ....-+|______|__.-||__)`-' (((/ (((/ CATS are awesome! */