skiilaa

Controlling Wemos OLED SHIELD with U8G2

Jan 27th, 2017
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <Arduino.h>
  2. #include <SPI.h>
  3. #include <U8g2lib.h>
  4.  
  5. /* Constructor */
  6. U8G2_SSD1306_64X48_ER_F_HW_I2C u8g2(U8G2_R0);
  7.  
  8. /* u8g2.begin() is required and will sent the setup/init sequence to the display */
  9. void setup(void) {
  10.   u8g2.begin();
  11. }
  12.  
  13. /* draw something on the display with the `firstPage()`/`nextPage()` loop*/
  14. void loop(void) {
  15.   u8g2.firstPage();
  16.   do {
  17.     u8g2.setFont(u8g2_font_saikyosansbold8_8u);
  18.     u8g2.drawStr(0,20,"HELLO");
  19.     u8g2.drawStr(0,30, "WORLD!");
  20.   } while ( u8g2.nextPage() );
  21.   delay(1000);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment