#include <U8g2lib.h>
//U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
#define nut1 9
#define led 10
void setup() {
// put your setup code here, to run once:
pinMode(nut1, INPUT_PULLUP);
pinMode(led , OUTPUT);
u8g2.begin();
}
void loop() {
if(digitalRead(nut1) == LOW){
digitalWrite(led, HIGH);
} else {
digitalWrite(led, LOW);
}
u8g2.clearBuffer(); // clear the internal memory
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
u8g2.drawStr(0,10,"Hello World!");
u8g2.setCursor(0, 30);
u8g2.print(h); // write something to the internal memory
u8g2.sendBuffer(); // transfer internal memory to the display
}