Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
from machine import Pin
import random
led = Pin(2, Pin.OUT)
lightLevel = random.randint(0,100)
if lightLevel < 50:
led.value(1)
print("LED ON")
else:
led.value(0)
print("LED OFF")
print(f"Light Level: {lightLevel}")Coding works best on desktop or with an external keyboard.