Advertisement
elektronek

Attila Csergo - u8g2 simple demo

Sep 16th, 2019
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Arduino.h>
  2. #include <U8g2lib.h>
  3. #include <SPI.h>
  4.  
  5. U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
  6.  
  7. void setup(void) {
  8.   u8g2.begin();
  9. }
  10.  
  11. void loop(void) {
  12.   u8g2.clearBuffer();                   // clear the internal memory
  13.   u8g2.setFont(u8g2_font_ncenB08_tr);   // choose a suitable font
  14.   u8g2.drawStr(0,10,"Hello World!");    // write something to the internal memory
  15.   u8g2.sendBuffer();                    // transfer internal memory to the display
  16.   delay(1000);  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement