from machine import Pin, I2C
import ssd1306
light_pin = Pin(2, Pin.OUT)
i2c = I2C(scl=Pin(22), sda=Pin(23))
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
def update_display(status):
oled.fill(0)
oled.text("Light Control", 0, 0)
oled.text("Status:"+ status, 0, 20)
oled.show()
def turn_on_light():
light_pin.value(1)
update_display("ON")
def turn_off_light():
light_pin.value(0)
update_display("OFF")
turn_off_light()
while True:
command = input("Enter command (on/off):").strip()lower()
if command == "on":
ture_on_light()
elif command == "off":
ture_off_light()
else:
print("Invalid cammand")