When I go to Tools/Micropython/Micropython REPL I can turn on/off LED. But with this code below, nothing happens.
Code: Select all
import utime
from machine import Pin
def main():
led = Pin(23, Pin.OUT)
enabled = False
while True:
if enabled:
led.off()
else:
led.on()
utime.sleep_ms(1000)
enabled = not enabled
if __name__ == '__main__':
main()
Why?