ARDUINO UNO와 OLED, AL12832AWWB-H-U02에서 Hello World 표시 (U8g2lib)

1.arduino ide 1.8.11을 시작, U8g2 설치
2.arduino uno 선택
3. 소스 예제에서 HelloWorld 선택
4.U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0,/* reset=*/U8X8_PIN_NONE);//Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED
선택


#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);  // Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.clearBuffer();                   // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB08_tr);   // choose a suitable font
  u8g2.drawStr(0,10,"Hello World!");    // write something to the internal memory
  u8g2.sendBuffer();                    // transfer internal memory to the display
  delay(1000);  
}


좋은 웹페이지 즐겨찾기