Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*********************************************************************
- This is an example for our Monochrome OLEDs based on SSD1306 drivers
- Pick one up today in the adafruit shop!
- ------> http://www.adafruit.com/category/63_98
- This example is for a 128x64 size display using SPI to communicate
- 4 or 5 pins are required to interface
- Adafruit invests time and resources providing this open source code,
- please support Adafruit and open-source hardware by purchasing
- products from Adafruit!
- Written by Limor Fried/Ladyada for Adafruit Industries.
- BSD license, check license.txt for more information
- All text above, and the splash screen must be included in any redistribution
- *********************************************************************/
- #include <SPI.h>
- #include <Wire.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_SSD1306.h>
- // If using software SPI (the default case):
- #define OLED_MOSI 9
- #define OLED_CLK 10
- #define OLED_DC 11
- #define OLED_CS 12
- #define OLED_RESET 13
- Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
- /* Uncomment this block to use hardware SPI
- #define OLED_DC 6
- #define OLED_CS 7
- #define OLED_RESET 8
- Adafruit_SSD1306 display(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, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff,
- 0xf6, 0xf8, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x1f, 0xc0, 0x00, 0x1e, 0x7f, 0x00, 0x00, 0x00,
- 0xec, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xfc,
- 0xdc, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xfc,
- 0xdc, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0x00, 0x00,
- 0xdd, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff,
- 0xc9, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff,
- 0xff, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff,
- 0xff, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff,
- 0xff, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff,
- 0xff, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff,
- 0xff, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0x9f, 0xdf, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xff,
- 0xff, 0xf9, 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);
- }
Add Comment
Please, Sign In to add comment