├── .gitignore ├── .DS_Store ├── .gitattributes ├── esp32.PcbDoc ├── images ├── .DS_Store ├── IMG_3454.JPG ├── IMG_3454.png ├── IMG_3455.JPG ├── IMG_3455.png ├── IMG_3456.JPG └── IMG_3456.png ├── README.md └── ssd1306_128x32_i2c └── ssd1306_128x32_i2c.ino /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/.DS_Store -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /esp32.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/esp32.PcbDoc -------------------------------------------------------------------------------- /images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/images/.DS_Store -------------------------------------------------------------------------------- /images/IMG_3454.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/images/IMG_3454.JPG -------------------------------------------------------------------------------- /images/IMG_3454.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/images/IMG_3454.png -------------------------------------------------------------------------------- /images/IMG_3455.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/images/IMG_3455.JPG -------------------------------------------------------------------------------- /images/IMG_3455.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/images/IMG_3455.png -------------------------------------------------------------------------------- /images/IMG_3456.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/images/IMG_3456.JPG -------------------------------------------------------------------------------- /images/IMG_3456.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eddddddddy/esp32-blackpill-oled/HEAD/images/IMG_3456.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esp32-blackpill-oled 2 | An esp32 duel-core mcu development kit. designed like a bluepill(stm32f103c8t6). with a 0.91 oled. 3 | 4 | [Video Introduction](https://www.bilibili.com/video/BV1hK4y1H7HB) 5 | 6 | ![image1](images/IMG_3454.JPG) 7 | 8 | ![image2](images/IMG_3455.JPG) 9 | 10 | ![image3](images/IMG_3456.JPG) 11 | -------------------------------------------------------------------------------- /ssd1306_128x32_i2c/ssd1306_128x32_i2c.ino: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | This is an example for our Monochrome OLEDs based on SSD1306 drivers 3 | 4 | Pick one up today in the adafruit shop! 5 | ------> http://www.adafruit.com/category/63_98 6 | 7 | This example is for a 128x32 pixel display using I2C to communicate 8 | 3 pins are required to interface (two I2C and one reset). 9 | 10 | Adafruit invests time and resources providing this open 11 | source code, please support Adafruit and open-source 12 | hardware by purchasing products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries, 15 | with contributions from the open source community. 16 | BSD license, check license.txt for more information 17 | All text above, and the splash screen below must be 18 | included in any redistribution. 19 | **************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #define SCREEN_WIDTH 128 // OLED display width, in pixels 27 | #define SCREEN_HEIGHT 32 // OLED display height, in pixels 28 | 29 | // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) 30 | #define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin) 31 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire1, OLED_RESET); 32 | 33 | #define NUMFLAKES 10 // Number of snowflakes in the animation example 34 | 35 | #define LOGO_HEIGHT 16 36 | #define LOGO_WIDTH 16 37 | static const unsigned char PROGMEM logo_bmp[] = 38 | { B00000000, B11000000, 39 | B00000001, B11000000, 40 | B00000001, B11000000, 41 | B00000011, B11100000, 42 | B11110011, B11100000, 43 | B11111110, B11111000, 44 | B01111110, B11111111, 45 | B00110011, B10011111, 46 | B00011111, B11111100, 47 | B00001101, B01110000, 48 | B00011011, B10100000, 49 | B00111111, B11100000, 50 | B00111111, B11110000, 51 | B01111100, B11110000, 52 | B01110000, B01110000, 53 | B00000000, B00110000 }; 54 | 55 | void setup() { 56 | Serial.begin(9600); 57 | 58 | Wire1.begin(18,19); 59 | // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally 60 | if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 61 | Serial.println(F("SSD1306 allocation failed")); 62 | for(;;); // Don't proceed, loop forever 63 | } 64 | 65 | // Show initial display buffer contents on the screen -- 66 | // the library initializes this with an Adafruit splash screen. 67 | display.display(); 68 | delay(2000); // Pause for 2 seconds 69 | 70 | // Clear the buffer 71 | display.clearDisplay(); 72 | 73 | // Draw a single pixel in white 74 | display.drawPixel(10, 10, SSD1306_WHITE); 75 | 76 | // Show the display buffer on the screen. You MUST call display() after 77 | // drawing commands to make them visible on screen! 78 | display.display(); 79 | delay(2000); 80 | // display.display() is NOT necessary after every single drawing command, 81 | // unless that's what you want...rather, you can batch up a bunch of 82 | // drawing operations and then update the screen all at once by calling 83 | // display.display(). These examples demonstrate both approaches... 84 | 85 | testdrawline(); // Draw many lines 86 | 87 | testdrawrect(); // Draw rectangles (outlines) 88 | 89 | testfillrect(); // Draw rectangles (filled) 90 | 91 | testdrawcircle(); // Draw circles (outlines) 92 | 93 | testfillcircle(); // Draw circles (filled) 94 | 95 | testdrawroundrect(); // Draw rounded rectangles (outlines) 96 | 97 | testfillroundrect(); // Draw rounded rectangles (filled) 98 | 99 | testdrawtriangle(); // Draw triangles (outlines) 100 | 101 | testfilltriangle(); // Draw triangles (filled) 102 | 103 | testdrawchar(); // Draw characters of the default font 104 | 105 | testdrawstyles(); // Draw 'stylized' characters 106 | 107 | testscrolltext(); // Draw scrolling text 108 | 109 | testdrawbitmap(); // Draw a small bitmap image 110 | 111 | // Invert and restore display, pausing in-between 112 | display.invertDisplay(true); 113 | delay(1000); 114 | display.invertDisplay(false); 115 | delay(1000); 116 | 117 | testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps 118 | } 119 | 120 | void loop() { 121 | } 122 | 123 | void testdrawline() { 124 | int16_t i; 125 | 126 | display.clearDisplay(); // Clear display buffer 127 | 128 | for(i=0; i=0; i-=4) { 148 | display.drawLine(0, display.height()-1, display.width()-1, i, SSD1306_WHITE); 149 | display.display(); 150 | delay(1); 151 | } 152 | delay(250); 153 | 154 | display.clearDisplay(); 155 | 156 | for(i=display.width()-1; i>=0; i-=4) { 157 | display.drawLine(display.width()-1, display.height()-1, i, 0, SSD1306_WHITE); 158 | display.display(); 159 | delay(1); 160 | } 161 | for(i=display.height()-1; i>=0; i-=4) { 162 | display.drawLine(display.width()-1, display.height()-1, 0, i, SSD1306_WHITE); 163 | display.display(); 164 | delay(1); 165 | } 166 | delay(250); 167 | 168 | display.clearDisplay(); 169 | 170 | for(i=0; i0; i-=3) { 225 | // The INVERSE color is used so circles alternate white/black 226 | display.fillCircle(display.width() / 2, display.height() / 2, i, SSD1306_INVERSE); 227 | display.display(); // Update screen with each newly-drawn circle 228 | delay(1); 229 | } 230 | 231 | delay(2000); 232 | } 233 | 234 | void testdrawroundrect(void) { 235 | display.clearDisplay(); 236 | 237 | for(int16_t i=0; i0; i-=5) { 280 | // The INVERSE color is used so triangles alternate white/black 281 | display.fillTriangle( 282 | display.width()/2 , display.height()/2-i, 283 | display.width()/2-i, display.height()/2+i, 284 | display.width()/2+i, display.height()/2+i, SSD1306_INVERSE); 285 | display.display(); 286 | delay(1); 287 | } 288 | 289 | delay(2000); 290 | } 291 | 292 | void testdrawchar(void) { 293 | display.clearDisplay(); 294 | 295 | display.setTextSize(1); // Normal 1:1 pixel scale 296 | display.setTextColor(SSD1306_WHITE); // Draw white text 297 | display.setCursor(0, 0); // Start at top-left corner 298 | display.cp437(true); // Use full 256 char 'Code Page 437' font 299 | 300 | // Not all the characters will fit on the display. This is normal. 301 | // Library will draw what it can and the rest will be clipped. 302 | for(int16_t i=0; i<256; i++) { 303 | if(i == '\n') display.write(' '); 304 | else display.write(i); 305 | } 306 | 307 | display.display(); 308 | delay(2000); 309 | } 310 | 311 | void testdrawstyles(void) { 312 | display.clearDisplay(); 313 | 314 | display.setTextSize(1); // Normal 1:1 pixel scale 315 | display.setTextColor(SSD1306_WHITE); // Draw white text 316 | display.setCursor(0,0); // Start at top-left corner 317 | display.println(F("Hello, world!")); 318 | 319 | display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text 320 | display.println(3.141592); 321 | 322 | display.setTextSize(2); // Draw 2X-scale text 323 | display.setTextColor(SSD1306_WHITE); 324 | display.print(F("0x")); display.println(0xDEADBEEF, HEX); 325 | 326 | display.display(); 327 | delay(2000); 328 | } 329 | 330 | void testscrolltext(void) { 331 | display.clearDisplay(); 332 | 333 | display.setTextSize(2); // Draw 2X-scale text 334 | display.setTextColor(SSD1306_WHITE); 335 | display.setCursor(10, 0); 336 | display.println(F("scroll")); 337 | display.display(); // Show initial text 338 | delay(100); 339 | 340 | // Scroll in various directions, pausing in-between: 341 | display.startscrollright(0x00, 0x0F); 342 | delay(2000); 343 | display.stopscroll(); 344 | delay(1000); 345 | display.startscrollleft(0x00, 0x0F); 346 | delay(2000); 347 | display.stopscroll(); 348 | delay(1000); 349 | display.startscrolldiagright(0x00, 0x07); 350 | delay(2000); 351 | display.startscrolldiagleft(0x00, 0x07); 352 | delay(2000); 353 | display.stopscroll(); 354 | delay(1000); 355 | } 356 | 357 | void testdrawbitmap(void) { 358 | display.clearDisplay(); 359 | 360 | display.drawBitmap( 361 | (display.width() - LOGO_WIDTH ) / 2, 362 | (display.height() - LOGO_HEIGHT) / 2, 363 | logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1); 364 | display.display(); 365 | delay(1000); 366 | } 367 | 368 | #define XPOS 0 // Indexes into the 'icons' array in function below 369 | #define YPOS 1 370 | #define DELTAY 2 371 | 372 | void testanimate(const uint8_t *bitmap, uint8_t w, uint8_t h) { 373 | int8_t f, icons[NUMFLAKES][3]; 374 | 375 | // Initialize 'snowflake' positions 376 | for(f=0; f< NUMFLAKES; f++) { 377 | icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width()); 378 | icons[f][YPOS] = -LOGO_HEIGHT; 379 | icons[f][DELTAY] = random(1, 6); 380 | Serial.print(F("x: ")); 381 | Serial.print(icons[f][XPOS], DEC); 382 | Serial.print(F(" y: ")); 383 | Serial.print(icons[f][YPOS], DEC); 384 | Serial.print(F(" dy: ")); 385 | Serial.println(icons[f][DELTAY], DEC); 386 | } 387 | 388 | for(;;) { // Loop forever... 389 | display.clearDisplay(); // Clear the display buffer 390 | 391 | // Draw each snowflake: 392 | for(f=0; f< NUMFLAKES; f++) { 393 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SSD1306_WHITE); 394 | } 395 | 396 | display.display(); // Show the display buffer on the screen 397 | delay(200); // Pause for 1/10 second 398 | 399 | // Then update coordinates of each flake... 400 | for(f=0; f< NUMFLAKES; f++) { 401 | icons[f][YPOS] += icons[f][DELTAY]; 402 | // If snowflake is off the bottom of the screen... 403 | if (icons[f][YPOS] >= display.height()) { 404 | // Reinitialize to a random position, just off the top 405 | icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width()); 406 | icons[f][YPOS] = -LOGO_HEIGHT; 407 | icons[f][DELTAY] = random(1, 6); 408 | } 409 | } 410 | } 411 | } 412 | --------------------------------------------------------------------------------