#include #include #include #include #include #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET); #define LED_PIN PB8 #define BRIGHTNESS 255 #define LED_TYPE WS2812 #define COLOR_ORDER GRB #define screeny 60 CRGB leds[screeny]; CRGBPalette16 currentPalette; TBlendType currentBlending; #define UPDATES_PER_SECOND 5000 extern CRGBPalette16 myRedWhiteBluePalette; #define power PB1 #define vbat PA0 #define rot PA5 #define grun PA7 #define blau PA6 #define uv PB5 #define weis PB0 #define c1 PB12 #define c2 PB13 #define c3 PB14 #define c4 PB15 #define c5 PA8 #define c6 PB11 #define c7 PB10 #define temp1 PA1 #define temp2 PA2 #define temp3 PA3 #define temp4 PA4 long tim = millis(); // // Image data for powebank_bootscreen // const unsigned char PROGMEM meowscreen [] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ##### 0x00, 0x00, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x0F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, // ######## ####### 0x00, 0x00, 0x00, 0x40, 0x07, 0x80, 0x00, 0x3F, 0xF8, 0x03, 0x00, 0x00, 0x00, 0x00, // # #### ########### ## 0x00, 0x00, 0x00, 0x60, 0x0C, 0x00, 0x00, 0x70, 0x1C, 0x03, 0x00, 0x00, 0x00, 0x00, // ## ## ### ### ## 0x00, 0x00, 0x00, 0x60, 0x0C, 0x00, 0x00, 0xE0, 0x0E, 0x03, 0x00, 0x00, 0x00, 0x00, // ## ## ### ### ## 0x00, 0x00, 0x00, 0x70, 0x0C, 0x00, 0x00, 0xC0, 0x06, 0x06, 0x01, 0xC0, 0x00, 0x00, // ### ## ## ## ## ### 0x00, 0x00, 0x00, 0x70, 0x06, 0x00, 0x01, 0x80, 0x06, 0x06, 0x03, 0xC0, 0x00, 0x00, // ### ## ## ## ## #### 0x00, 0x00, 0x00, 0x70, 0x06, 0x1F, 0x01, 0x80, 0x06, 0x06, 0x07, 0xC0, 0x00, 0x00, // ### ## ##### ## ## ## ##### 0x00, 0x04, 0x00, 0x78, 0x07, 0xFE, 0x01, 0x80, 0x06, 0x06, 0x0E, 0xC0, 0x00, 0x00, // # #### ########## ## ## ## ### ## 0x00, 0x06, 0x00, 0x78, 0x03, 0xF0, 0x01, 0x80, 0x06, 0x06, 0x18, 0xC0, 0x30, 0x00, // ## #### ###### ## ## ## ## ## ## 0x00, 0x07, 0x00, 0x7C, 0x03, 0x00, 0x01, 0x80, 0x06, 0x06, 0x39, 0xC0, 0xF8, 0x00, // ### ##### ## ## ## ## ### ### ##### 0x00, 0x07, 0x80, 0x6C, 0x03, 0x00, 0x01, 0x80, 0x0C, 0x06, 0x71, 0x81, 0xC0, 0x00, // #### ## ## ## ## ## ## ### ## ### 0x00, 0x03, 0xC0, 0x6C, 0x03, 0x00, 0x01, 0x80, 0x0C, 0x06, 0xE1, 0x87, 0x80, 0x00, // #### ## ## ## ## ## ## ### ## #### 0x00, 0x03, 0xE0, 0x6E, 0x03, 0x3C, 0x00, 0xC0, 0x18, 0x06, 0xC3, 0x0E, 0x00, 0x00, // ##### ## ### ## #### ## ## ## ## ## ### 0x00, 0x03, 0xB8, 0x66, 0x03, 0xFF, 0x00, 0x60, 0x30, 0x07, 0xC3, 0x1C, 0x00, 0x00, // ### ### ## ## ########## ## ## ##### ## ### 0x00, 0x01, 0x9C, 0x67, 0x03, 0xC7, 0x00, 0x3F, 0xE0, 0x07, 0x83, 0x38, 0x00, 0x00, // ## ### ## ### #### ### ######### #### ## ### 0x00, 0x01, 0xC7, 0x63, 0x83, 0x00, 0x00, 0x1F, 0xC0, 0x06, 0x03, 0x70, 0x00, 0x00, // ### ### ## ### ## ####### ## ## ### 0x00, 0x01, 0xC7, 0xE1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, // ### ###### ## ## ## 0x00, 0x00, 0xC1, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, // ## #### #### 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, // ### # #### 0x00, 0x00, 0x60, 0x00, 0x3E, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ## ##### # ## 0x00, 0x00, 0x60, 0x00, 0x3F, 0xC0, 0x38, 0x00, 0x3F, 0x80, 0x00, 0x80, 0x00, 0x00, // ## ######## ### ####### # 0x00, 0x00, 0x60, 0x00, 0x23, 0xF0, 0x28, 0x08, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, // ## # ###### # # # ######## 0x00, 0x00, 0x60, 0x00, 0x28, 0xF8, 0x6F, 0xC9, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, // ## # # ##### ## ###### # #### # 0x00, 0x00, 0x00, 0x00, 0x2E, 0x3D, 0xCC, 0x97, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, // # ### #### ### ## # # ##### # # 0x00, 0x00, 0x00, 0x00, 0x2F, 0x8F, 0x06, 0xA0, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, // # ##### #### ## # # ### # 0x00, 0x00, 0x00, 0x00, 0x27, 0xE0, 0x01, 0x40, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, // # ###### # # #### # 0x00, 0x00, 0x00, 0x00, 0x37, 0xF7, 0xC1, 0x0E, 0x7D, 0x00, 0x00, 0x00, 0x00, 0x00, // ## ####### ##### # ### ##### # 0x00, 0x00, 0x00, 0x00, 0x17, 0xE7, 0xE1, 0x10, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, // # ###### ###### # # ### # 0x00, 0x00, 0x00, 0x00, 0x13, 0xEF, 0xE2, 0x20, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, // # ##### ####### # # # # 0x00, 0x00, 0x00, 0x00, 0x19, 0x8F, 0xA0, 0x4E, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, // ## ## ##### # # ### # ## 0x00, 0x00, 0x00, 0x00, 0x0D, 0x88, 0x20, 0x70, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // ## ## # # ### # 0x00, 0x00, 0x00, 0x00, 0x04, 0x8F, 0xE0, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // # # ####### # # 0x00, 0x00, 0x00, 0x00, 0x06, 0x08, 0x20, 0x0E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // ## # # ### # 0x00, 0x00, 0x00, 0x00, 0x02, 0x83, 0x87, 0x31, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, // # # ### ### ## ## # # 0x00, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x62, 0x0C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, // ## ## ## # ## ### 0x00, 0x00, 0x00, 0x00, 0x0C, 0x10, 0xC0, 0x03, 0x08, 0x00, 0x00, 0x00, 0x0C, 0x00, // ## # ## ## # ## 0x00, 0x00, 0x00, 0x00, 0x11, 0x03, 0x02, 0x00, 0xB2, 0x00, 0x00, 0x00, 0x1B, 0x00, // # # ## # # ## # ## ## 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0C, 0x04, 0xC0, 0x0C, 0x00, 0x00, 0x00, 0x11, 0x00, // ### ## # ## ## # # 0x00, 0x00, 0x00, 0x00, 0x02, 0x90, 0x24, 0x40, 0x04, 0x00, 0x00, 0x00, 0x19, 0x00, // # # # # # # # ## # 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x1B, 0x80, 0x6E, 0x00, 0x00, 0x01, 0x9B, 0x00, // # # ## ### ## ### ## ## ## 0x00, 0x00, 0x00, 0x00, 0x03, 0xF8, 0x00, 0x03, 0x90, 0x00, 0x00, 0x01, 0xCF, 0xC0, // ####### ### # ### ###### 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x06, 0x30, // # ## # # # ## ## 0x0F, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0D, 0x37, 0x00, // #### ## ## ## # ## ### 0x19, 0x80, 0x00, 0x00, 0x00, 0x01, 0x80, 0x08, 0x00, 0x00, 0x00, 0x8D, 0xF3, 0x00, // ## ## ## # # ## ##### ## 0x10, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x18, 0x00, 0x00, 0x00, 0xCD, 0xC1, 0x00, // # # # ## ## ## ### # 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x18, 0xCD, 0x98, 0x00, // ## # # ## ## ## ## ## 0x0C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x07, 0x18, 0xCC, 0xF8, 0x00, // ## # # # ### ## ## ## ##### 0x84, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x9C, 0xEC, 0x60, 0x00, // # # ## ###### ### ### ## ## 0xCC, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3F, 0xCE, 0xBC, 0x00, 0x00, // ## ## ## ## #### ######## ### # #### 0x78, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3C, 0xC7, 0x9C, 0x00, 0x00, // #### ## ## ## ## #### ## #### ### 0x00, 0xC6, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x38, 0x63, 0x8C, 0x00, 0x00, // ## ## #### # ## ### ## ### ## 0x00, 0x8C, 0x33, 0x20, 0x00, 0x00, 0x00, 0x00, 0x43, 0x38, 0x63, 0x80, 0x00, 0x00, // # ## ## ## # # ## ### ## ### 0x00, 0x98, 0x79, 0x63, 0x00, 0x00, 0x00, 0x00, 0x63, 0x18, 0x61, 0x80, 0x00, 0x00, // # ## #### # ## ## ## ## ## ## ## 0x00, 0xF8, 0x4E, 0x46, 0x3C, 0x8C, 0x70, 0x80, 0x63, 0x1C, 0xE0, 0x00, 0x00, 0x00, // ##### # ### # ## #### # ## ### # ## ## ### ### 0x00, 0x00, 0xC8, 0xCC, 0x10, 0x88, 0x88, 0x80, 0x36, 0x0F, 0xC0, 0x00, 0x00, 0x00, // ## # ## ## # # # # # # ## ## ###### 0x00, 0x00, 0x88, 0xD8, 0x31, 0x10, 0x88, 0x80, 0x3C, 0x0F, 0xC0, 0x00, 0x00, 0x00, // # # ## ## ## # # # # # #### ###### 0x00, 0x00, 0x08, 0xF0, 0x61, 0x31, 0xF8, 0x80, 0x18, 0x07, 0x80, 0x00, 0x00, 0x00, // # #### ## # ## ###### # ## #### 0x00, 0x00, 0x00, 0xC0, 0x41, 0x21, 0x08, 0x80, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, // ## # # # # # # ### 0x00, 0x00, 0x00, 0x01, 0xE1, 0xC3, 0x0C, 0xF0, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, // #### ### ## ## #### ## 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // ## }; void setup(){ delay(250); pinMode(power, OUTPUT); pinMode(uv, OUTPUT); pinMode(rot, OUTPUT); pinMode(blau, OUTPUT); pinMode(grun, OUTPUT); pinMode(weis, OUTPUT); pinMode(c1, INPUT); pinMode(c2, INPUT); pinMode(c3, INPUT); pinMode(c4, INPUT); pinMode(c5, INPUT); pinMode(c6, INPUT); pinMode(c7, INPUT); delay(200); digitalWrite(power, HIGH); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64) display.clearDisplay(); FastLED.addLeds(leds, screeny).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; currentBlending = BLEND; } void loop(){ pixels(); regenbogen(); powercutting(); ledspectrum(); display.display(); } int countz =0; int offcountz =0; int color =0; int color2 =0; void pixels(void) { //digitalWrite(uv, HIGH); //digitalWrite(blau, HIGH); //digitalWrite(rot, HIGH); display.fillRect(0,0,128,64,BLACK); display.drawBitmap(7,2, meowscreen,112, 61, WHITE); //breite und höhe der sichtbaren caracter wichtig sonst bildstreifen display.drawCircle(64,32,countz/2 +10, WHITE); display.drawCircle(64,32,countz/1.8 +9, WHITE); display.drawCircle(64,32,countz/1.6 +9, WHITE); display.drawCircle(64,32,countz/1.4 +9, WHITE); display.drawCircle(64,32,countz/1.2 +9, WHITE); if (countz >150) { display.fillRect(0,0,128,64,BLACK); display.setTextColor(WHITE); display.setTextSize(1); display.setCursor(0,0); display.print("MEOW"); display.setCursor(0,9); display.print("temp1-> "); display.print(analogRead(temp1)); display.setCursor(0,18); display.print("temp2-> "); display.print(analogRead(temp2)); display.setCursor(0,27); display.print("temp3-> "); display.print(analogRead(temp3)); display.setCursor(0,36); display.print("temp4-> "); display.print(analogRead(temp4)); display.setCursor(0,48); display.print("cells-> "); display.print(analogRead(vbat)); }else{ countz++; } } void regenbogen(void){ color2+=10; color =color2; for( int i = 0; i < 16; i++) { color+=40; leds[i] = ColorFromPalette( currentPalette,color, 255, currentBlending); FastLED.show(); FastLED.delay(1000 / 2000); }} void powercutting(void){ if (digitalRead(c1) ==HIGH && digitalRead(c7) == HIGH) { offcountz+=15; display.fillRect(0,0,128,64,BLACK); display.setTextSize(3); display.setCursor(10,10); display.print("OFF in:"); display.setTextSize(3); display.setCursor(40,40); display.print(1000-offcountz); } else {offcountz=0;} if (offcountz >1000) {digitalWrite(power, LOW);} } int colormody=1; int ledon =0; void ledspectrum(void){ if (digitalRead(c7) ==HIGH) {colormody++;} if (colormody > 12) {colormody=1;} if (digitalRead(c2) ==HIGH) {ledon++;} if (ledon >=2) { ledon =0; digitalWrite(weis, LOW); digitalWrite(uv, LOW); digitalWrite(rot, LOW);digitalWrite(grun, LOW);digitalWrite(blau, LOW);} if (ledon ==1) { if (colormody ==1) {digitalWrite(uv, HIGH);} if (colormody ==2) {digitalWrite(blau, HIGH);} if (colormody ==3) {digitalWrite(rot, HIGH);} if (colormody ==4) {digitalWrite(grun, HIGH);} if (colormody ==5) {digitalWrite(weis, HIGH);} } } //benutztes programm um aus bmp character array zu machen : The dot factory v1.0.4 //MEOW! its free use it or parts if there is somethink usefull for you //code by marderchen =^.^=