LCD 12864 호환 그래픽 쉴드로 LED 백라이트가 내장되어 있으며 대부분의 아두이노 제품과 호환 가능합니다. 문자,숫자,그래픽 표현이 가능하며 5개의 아나로그, 8개의 디지탈 I/O핀과 5 방향 소형 조이스틱 버튼이 내장되어 있습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include "U8glib.h" U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, CD = 9, RST = 8 void draw( void ) { // graphic commands to redraw the complete screen should be placed here u8g.setFont(u8g_font_unifont); //u8g.setFont(u8g_font_osb21); u8g.drawStr( 0, 20, "www.DFRobot.com" ); } void setup( void ) { u8g.setContrast(0); // Config the contrast to the best effect u8g.setRot180(); // rotate screen, if required // set SPI backup if required //u8g.setHardwareBackup(u8g_backup_avr_spi); // assign default color value if ( u8g.getMode() == U8G_MODE_R3G3B2 ) { u8g.setColorIndex(255); // white } else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) { u8g.setColorIndex(3); // max intensity } else if ( u8g.getMode() == U8G_MODE_BW ) { u8g.setColorIndex(1); // pixel on } else if ( u8g.getMode() == U8G_MODE_HICOLOR ) { u8g.setHiColorByRGB(255,255,255); } } void loop( void ) { // picture loop u8g.firstPage(); do { draw(); } while ( u8g.nextPage() ); // rebuild the picture after some delay delay(500); } |