31 lines
1.1 KiB
C++
31 lines
1.1 KiB
C++
#include <Arduino.h>
|
|
#include <SPI.h>
|
|
|
|
#include <U8g2lib.h>
|
|
|
|
U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
|
//U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
|
//U8G2_SSD1306_128X64_NONAME_1_3W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8);
|
|
//U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* reset=*/ 8);
|
|
//U8G2_SSD1306_128X64_NONAME_1_6800 u8g2(U8G2_R0, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
|
|
//U8G2_SSD1306_128X64_NONAME_1_8080 u8g2(U8G2_R0, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
|
|
|
|
|
|
|
|
void setup(void) {
|
|
pinMode(9, OUTPUT);
|
|
digitalWrite(9, 0); // default output in I2C mode for the SSD1306 test shield: set the i2c adr to 0
|
|
|
|
u8g2.begin();
|
|
}
|
|
|
|
void loop(void) {
|
|
u8g2.firstPage();
|
|
do {
|
|
u8g2.setFont(u8g2_font_ncenB14_tr);
|
|
u8g2.drawStr(0,20,"Hello World!");
|
|
} while ( u8g2.nextPage() );
|
|
delay(1000);
|
|
}
|
|
|