OLED 0.96인치 SPI 통신
PIN
GND : Power ground
VCC : 3.3V or 5V
D0 : CLK clock
D1 : MOSI data
RST : Reset
DS : data/command
CS : chip-select signal
SPI 결선
D0 D1 DC CS
uno 13 11 9 10
mega 52 51 49 53
SSD1306 컨트롤러를 사용하며 126x64의 해상도를 가지고 있다.
라이브러리는 https://code.google.com/p/u8glib/ 에서 다운받아 설치.
u8glib 예저 프로그램중 HelloWorld를 열고, 주석처리되어 있는 부분중에 보드와 맞는 침을 찾아 주석을 해제
"U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9"
EX) HelloWorld!
1. LOOP
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
// rebuild the picture after some delay
delay(1000);
}
2. Graphics Output
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(u8g_font_unifont);
u8g.drawStr( 0, 20, "Hello World!"); // x=0, y=20
}