from machine import Pin, I2C
import ssd1306
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
switch1 = Pin(15, Pin.IN)
switch2 = Pin(18, Pin.IN)
led = Pin(0, Pin.OUT)
oled.fill(0)
oled.show()
def update_display():
oled.fill(0)
oled.text('Srisaket', 0, 10)
oled.text('Rajabpat', 0, 20)
oled.text('University', 0, 30)
oled.text('ComSci', 0, 40)
oled.text('Sirimongkol Manubut', 0, 50)
oled.show()
update_display()
switch2_state = switch2.value()
while True:
if switch1.value() == 1:
led.on()
update_display()
else:
led.off()
if switch2.value() != switch2_state:
switch2_state = switch2.value()
if switch2_state == 1:
led.off()
oled.fill(0)
oled.show()