Step step:
1. pilih board esp32 dev module
2. pilih port sesuai device
3. hubungkan oled ke esp32 via jalur i2c, sda=pin 21 scl pin 22.
/* HelloWorld.ino - ESp32 - OLED 1.3in 128x64 - U8g2 libwww.yogyatechno.com*/ #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_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); //Display OLED I2C 1.3inc OKE void setup(void) { u8g2.begin(); } void loop(void) { u8g2.firstPage(); do { u8g2.setFont(u8g2_font_ncenB10_tr); u8g2.drawStr(0,24,"Hello World!"); } while ( u8g2.nextPage() ); delay(1000); }
Share This :
librarynya mana?
ReplyDelete