/* * This combines code from the OLED display of the "Girls Who Code" logo * with code to use the NodeMCU. * * The easiest way to set up the OLED with a NodeMCU is to place the NodeMCU onto a * breadboard so that it takes up holes b1-b15 and i1-i15 on the breadboard with the * micro USB port pointing "up" (it should hang over the edge of the breadboard), and * then plug the OLED pins into holes a9-a15, so that the "CS" pin on the OLED matches * up with the "D0" pin on the NodeMCU (at the "bottom", near the squiggly copper wifi * antenna). OLED pin "VCC" should match up with the "3V3" pin on the NodeMCU, and * OLED pin "GND" should match up with the "GND" pin on the NodeMCU. * * In the Arduino IDE, make sure go to Tools > Board and select "NodeMCU 1.0", * otherwise it won't work! * * If you want to make your own bitmap (black & white) images, the maximum size for * the 0.96" OLED is 128 pixels wide by 32 pixels tall. Use this online tool to convert * your graphics: * https://javl.github.io/image2cpp/ */ #include #include #include #include // If using software SPI (the default case): #define OLED_CS D0 #define OLED_DC D1 #define OLED_RESET D2 #define OLED_MOSI D3 // aka "D1" on the OLED #define OLED_CLK D4 // aka "D0" on the OLED Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); #define LOGO_GWC_HEIGHT 32 #define LOGO_GWC_WIDTH 128 const unsigned char logo_gwc_bmp[] PROGMEM = { // 'girls_who_code_logo_128x64, 128x64px 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xef, 0xff, 0xff, 0xff, 0xff, 0xf2, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xef, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xfe, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xf7, 0xe0, 0xfe, 0x7f, 0x87, 0xff, 0xcf, 0xbe, 0xf4, 0x7f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x3c, 0xe7, 0xee, 0xfe, 0xff, 0x7b, 0xff, 0xaf, 0x3e, 0x13, 0xbe, 0xf6, 0x7f, 0xff, 0xff, 0xff, 0x7c, 0xc7, 0xde, 0xfc, 0x7c, 0xfb, 0xff, 0x67, 0x3c, 0xf7, 0xbc, 0xf2, 0x7f, 0xff, 0xff, 0xff, 0x3c, 0xb7, 0xbf, 0x73, 0x3b, 0x73, 0x7f, 0xf6, 0x19, 0xf7, 0xb8, 0xf6, 0x7f, 0xff, 0xff, 0xff, 0xc6, 0x78, 0xff, 0x8f, 0xcf, 0x8b, 0xff, 0xf9, 0xc7, 0xf7, 0xc7, 0x1e, 0x7f, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 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, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0x9f, 0xcf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #define SSD1306_LCDHEIGHT 64 #if (SSD1306_LCDHEIGHT != 64) #error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif void setup() { Serial.begin(9600); display.begin(SSD1306_SWITCHCAPVCC); display.clearDisplay(); } void loop() { // display the Girls Who Code logo! display.drawBitmap(0, 0, logo_gwc_bmp, LOGO_GWC_WIDTH, LOGO_GWC_HEIGHT, 1); display.display(); // invert the display so that it blinks! display.invertDisplay(true); delay(1000); display.invertDisplay(false); delay(1000); }