Advertisement
hwthinker

HelloWorld HwThinker on NodeMCUOLED-ESP8266

Feb 21st, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //--setting board nodemcu 1.0 (ESP12E Module)
  2. #include <Wire.h>  // Only needed for Arduino 1.6.5 and earlier
  3. #include "SSD1306Wire.h" // legacy include: `#include "SSD1306.h"`
  4.  
  5. // Initialize the OLED display using Wire library
  6. SSD1306Wire  display(0x3c, D1, D2);
  7.  
  8. void setup() {
  9.   Serial.begin(115200);
  10.   Serial.println();
  11.   Serial.println();
  12.  
  13.  
  14.   // Initialising the UI will init the display too.
  15.   display.init();
  16.  
  17.   display.flipScreenVertically();
  18.   display.setFont(ArialMT_Plain_10);
  19.  
  20. }
  21.  
  22. void loop() {
  23.   // clear the display
  24.   display.clear();
  25.   display.setTextAlignment(TEXT_ALIGN_LEFT);
  26.   display.setFont(ArialMT_Plain_10);
  27.   display.drawString(0, 0, "Hello HwThinker");
  28.   display.setFont(ArialMT_Plain_16);
  29.   display.drawString(0, 10, "Hello world");
  30.   display.setFont(ArialMT_Plain_24);
  31.   display.drawString(0, 26, "Hello world");
  32.   display.display();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement