Anfang beim Oled-Display hatte ich davon berichtet, dass das generieren der Bilder relativ aufwendig ist. Nun habe ich eine kleine Entscheidungslogik um Dazustellen wie das Wetter ist.
Bilder
Arduino Code
void setup() { display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) // init done display.clearDisplay(); // Show image buffer on the display hardware. // Since the buffer is intialized with an Adafruit splashscreen // internally, this will display the splashscreen. display.drawLine(0, 0, 128, 0, WHITE); display.setCursor(4, 2); display.setTextColor(WHITE); display.setTextSize(1); display.println(" Wetter am Sonneck"); display.drawLine(0, 10, 128, 10, WHITE); display.drawLine(0, 17, 125, 17, WHITE); display.println(""); display.setTextColor(BLACK, WHITE); display.println(" (c) Adrian Albers "); display.display(); delay(8000); // Clear the buffer. display.clearDisplay(); } void loop() { Bilder(); } void Bilder(){ int Regen = 2;//2durchSensorersetzen if (3 < Regen ) { Regen_Pic(); } else if (40 < lightMeter.readLightLevel()) { Sonne_Pic();//WennHellerals } else Wolken_Pic();//Sonst } //Sonne zeichnen void Sonne_Pic() { int x_ver = 30; display.clearDisplay(); display.drawLine( 0 + 50, 0 + 7, 127 - 50, 31 - 7, WHITE); display.drawLine( 1 + 50, 1 + 7, 128 - 50, 32 - 7, WHITE); display.drawLine( 0 + 50, 31 - 7, 127 - 50, 0 + 7, WHITE); display.drawLine( 1 + 50, 30 - 7, 126 - 50, 1 + 7, WHITE); display.drawLine( 63, 0 + 3, 63, 31 - 3, WHITE); display.drawLine( 62, 0 + 3, 64, 31 - 3, WHITE); display.drawLine( 0 + 45, 15, 127 - 45, 15, WHITE); display.drawLine( 0 + 45, 16, 127 - 45, 16, WHITE); display.fillCircle(display.width() / 2, display.height() / 2, 8, WHITE); display.display(); } //Regen zeichnen void Regen_Pic() { int x_ver = 30; display.clearDisplay(); display.drawPixel(9 + x_ver, 2, WHITE); display.drawPixel(48 + x_ver, 2, WHITE); display.drawPixel(9 + x_ver, 3, WHITE); display.drawPixel(27 + x_ver, 3, WHITE); display.drawLine( 47 + x_ver, 3, 48 + x_ver, 3, WHITE); display.drawLine( 8 + x_ver, 4, 10 + x_ver, 4, WHITE); display.drawPixel(27 + x_ver, 4, WHITE); display.drawLine( 47 + x_ver, 4, 49 + x_ver, 4, WHITE); display.drawLine( 8 + x_ver, 5, 11 + x_ver, 5, WHITE); display.drawLine( 27 + x_ver, 5, 28 + x_ver, 5, WHITE); display.drawLine( 46 + x_ver, 5, 49 + x_ver, 5, WHITE); display.drawLine( 7 + x_ver, 6, 11 + x_ver, 6, WHITE); display.drawLine( 26 + x_ver, 6, 28 + x_ver, 6, WHITE); display.drawLine( 46 + x_ver, 6, 50 + x_ver, 6, WHITE); display.drawLine( 7 + x_ver, 7, 12 + x_ver, 7, WHITE); display.drawLine( 25 + x_ver, 7, 29 + x_ver, 7, WHITE); display.drawLine( 45 + x_ver, 7, 50 + x_ver, 7, WHITE); display.drawLine( 6 + x_ver, 8, 12 + x_ver, 8, WHITE); display.drawLine( 25 + x_ver, 8, 30 + x_ver, 8, WHITE); display.drawLine( 45 + x_ver, 8, 51 + x_ver, 8, WHITE); display.drawLine( 6 + x_ver, 9, 13 + x_ver, 9, WHITE); display.drawLine( 24 + x_ver, 9, 30 + x_ver, 9, WHITE); display.drawLine( 44 + x_ver, 9, 51 + x_ver, 9, WHITE); display.drawLine( 5 + x_ver, 10, 13 + x_ver, 10, WHITE); display.drawLine( 24 + x_ver, 10, 31 + x_ver, 10, WHITE); display.drawLine( 44 + x_ver, 10, 52 + x_ver, 10, WHITE); display.drawLine( 4 + x_ver, 11, 15 + x_ver, 11, WHITE); display.drawLine( 23 + x_ver, 11, 32 + x_ver, 11, WHITE); display.drawLine( 43 + x_ver, 11, 52 + x_ver, 11, WHITE); display.drawLine( 4 + x_ver, 12, 15 + x_ver, 12, WHITE); display.drawLine( 23 + x_ver, 12, 32 + x_ver, 12, WHITE); display.drawLine( 43 + x_ver, 12, 52 + x_ver, 12, WHITE); display.drawLine( 4 + x_ver, 13, 15 + x_ver, 13, WHITE); display.drawLine( 22 + x_ver, 13, 32 + x_ver, 13, WHITE); display.drawLine( 42 + x_ver, 13, 53 + x_ver, 13, WHITE); display.drawLine( 4 + x_ver, 14, 15 + x_ver, 14, WHITE); display.drawLine( 22 + x_ver, 14, 33 + x_ver, 14, WHITE); display.drawLine( 42 + x_ver, 14, 53 + x_ver, 14, WHITE); display.drawLine( 4 + x_ver, 15, 15 + x_ver, 15, WHITE); display.drawLine( 22 + x_ver, 15, 33 + x_ver, 15, WHITE); display.drawLine( 43 + x_ver, 15, 53 + x_ver, 15, WHITE); display.drawLine( 4 + x_ver, 16, 15 + x_ver, 16, WHITE); display.drawLine( 21 + x_ver, 16, 34 + x_ver, 16, WHITE); display.drawLine( 43 + x_ver, 16, 52 + x_ver, 16, WHITE); display.drawLine( 5 + x_ver, 17, 14 + x_ver, 17, WHITE); display.drawLine( 21 + x_ver, 17, 34 + x_ver, 17, WHITE); display.drawLine( 44 + x_ver, 17, 52 + x_ver, 17, WHITE); display.drawLine( 6 + x_ver, 18, 13 + x_ver, 18, WHITE); display.drawLine( 21 + x_ver, 18, 34 + x_ver, 18, WHITE); display.drawLine( 44 + x_ver, 18, 51 + x_ver, 18, WHITE); display.drawLine( 7 + x_ver, 19, 12 + x_ver, 19, WHITE); display.drawLine( 21 + x_ver, 19, 33 + x_ver, 19, WHITE); display.drawLine( 46 + x_ver, 19, 50 + x_ver, 19, WHITE); display.drawLine( 22 + x_ver, 20, 33 + x_ver, 20, WHITE); display.drawLine( 22 + x_ver, 21, 32 + x_ver, 21, WHITE); display.drawLine( 23 + x_ver, 22, 32 + x_ver, 22, WHITE); display.drawLine( 24 + x_ver, 23, 31 + x_ver, 23, WHITE); display.drawLine( 26 + x_ver, 24, 29 + x_ver, 24, WHITE); display.display(); } //Wolke zeichnen void Wolken_Pic() { int x_ver = 30; display.drawLine( 0, 0, 128, 0, BLACK); display.drawLine( 0, 1, 128, 1, BLACK); display.drawLine( 0, 2, 128, 2, BLACK); display.drawLine( 0, 3, 128, 3, BLACK); display.drawLine(21 + x_ver, 4, 24 + x_ver, 4, WHITE); display.drawLine(20 + x_ver, 5, 25 + x_ver, 5, WHITE); display.drawLine(19 + x_ver, 6, 26 + x_ver, 6, WHITE); display.drawLine(18 + x_ver, 7, 27 + x_ver, 7, WHITE); display.drawLine( 12 + x_ver, 8, 15 + x_ver, 8, WHITE); display.drawLine( 18 + x_ver, 8, 27 + x_ver, 8, WHITE); display.drawLine( 30 + x_ver, 8, 33 + x_ver, 8, WHITE); display.drawLine( 10 + x_ver, 9, 35 + x_ver, 9, WHITE); display.drawLine( 9 + x_ver, 10, 36 + x_ver, 10, WHITE); display.drawLine( 39 + x_ver, 10, 44 + x_ver, 10, WHITE); display.drawLine( 9 + x_ver, 11, 36 + x_ver, 11, WHITE); display.drawLine( 39 + x_ver, 11, 45 + x_ver, 11, WHITE); display.drawLine( 9 + x_ver, 12, 36 + x_ver, 12, WHITE); display.drawLine( 39 + x_ver, 12, 46 + x_ver, 12, WHITE); display.drawLine( 9 + x_ver, 13, 36 + x_ver, 13, WHITE); display.drawLine( 40 + x_ver, 13, 46 + x_ver, 13, WHITE); display.drawLine( 50 + x_ver, 13, 51 + x_ver, 13, WHITE); display.drawLine( 9 + x_ver, 14, 36 + x_ver, 14, WHITE); display.drawLine( 39 + x_ver, 14, 54 + x_ver, 14, WHITE); display.drawLine( 9 + x_ver, 15, 36 + x_ver, 15, WHITE); display.drawLine( 40 + x_ver, 15, 55 + x_ver, 15, WHITE); display.drawLine( 9 + x_ver, 16, 35 + x_ver, 16, WHITE); display.drawLine( 41 + x_ver, 16, 55 + x_ver, 16, WHITE); display.drawLine( 7 + x_ver, 17, 34 + x_ver, 17, WHITE); display.drawLine( 37 + x_ver, 17, 38 + x_ver, 17, WHITE); display.drawLine( 41 + x_ver, 17, 56 + x_ver, 17, WHITE); display.drawLine( 6 + x_ver, 18, 33 + x_ver, 18, WHITE); display.drawLine( 36 + x_ver, 18, 38 + x_ver, 18, WHITE); display.drawLine( 42 + x_ver, 18, 56 + x_ver, 18, WHITE); display.drawLine( 6 + x_ver, 19, 39 + x_ver, 19, WHITE); display.drawLine( 42 + x_ver, 19, 56 + x_ver, 19, WHITE); display.drawLine( 6 + x_ver, 20, 39 + x_ver, 20, WHITE); display.drawLine( 42 + x_ver, 20, 55 + x_ver, 20, WHITE); display.drawLine( 6 + x_ver, 21, 39 + x_ver, 21, WHITE); display.drawLine( 42 + x_ver, 21, 55 + x_ver, 21, WHITE); display.drawLine( 6 + x_ver, 22, 38 + x_ver, 22, WHITE); display.drawLine( 42 + x_ver, 22, 57 + x_ver, 22, WHITE); display.drawLine( 7 + x_ver, 23, 38 + x_ver, 23, WHITE); display.drawLine( 41 + x_ver, 23, 58 + x_ver, 23, WHITE); display.drawLine( 8 + x_ver, 24, 37 + x_ver, 24, WHITE); display.drawLine( 41 + x_ver, 24, 58 + x_ver, 24, WHITE); display.drawLine( 40 + x_ver, 25, 58 + x_ver, 25, WHITE); display.drawLine( 38 + x_ver, 26, 58 + x_ver, 26, WHITE); display.drawLine( 26 + x_ver, 27, 58 + x_ver, 27, WHITE); display.drawLine( 26 + x_ver, 28, 57 + x_ver, 28, WHITE); display.drawLine( 27 + x_ver, 29, 56 + x_ver, 29, WHITE); display.display(); }