//Panos Papazoglou, MICRODEV.GR #include #include #include #include #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 #define OLED_DC 8 #define OLED_CS 10 #define OLED_RESET 9 Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, OLED_DC, OLED_RESET, OLED_CS); #define LOGO_HEIGHT 16 #define LOGO_WIDTH 16 static const unsigned char PROGMEM gr_flag[] = { B01100011, B00011000, B01100011, B00011000, B01100011, B00011000, B01100011, B11111111, B01100011, B00011000, B01100011, B00011000, B01100011, B00011000, B01100011, B01100110, B01100011, B01100110, B01100011, B01100110, B01100011, B01100110, B01100011, B01100110, B01100011, B01100110, B01100011, B01100110, B01100011, B01100110, B01100011, B01100110 }; void setup() { Serial.begin(9600); if(!oled.begin(SSD1306_SWITCHCAPVCC)) { Serial.println(F("SSD1306 allocation failed")); for(;;); } } void loop() { oled.clearDisplay(); for(int i=1;i<16;i++) { randomSeed(analogRead(0)); int x=random(0,100); int y=random(0,45); bitmap(x,y); delay(500); } delay(5000); } void bitmap(int x, int y) { oled.drawBitmap(x,y,gr_flag, LOGO_WIDTH, LOGO_HEIGHT, 1); oled.display(); }