User Manual
First, we have led.value = True . This line tells the LED to turn on. On the next line, we have time.sleep(0.5) . This line
is telling CircuitPython to pause running code for 0.5 seconds. Since this is between turning the led on and off, the led
will be on for 0.5 seconds.
The next two lines are similar. led.value = False tells the LED to turn off, and time.sleep(0.5) tells CircuitPython to
pause for another 0.5 seconds. This occurs between turning the led off and back on so the LED will be off for 0.5
seconds too.
Then the loop will begin again, and continue to do so as long as the code is running!
So, when you changed the first 0.5 to 0.1 , you decreased the amount of time that the code leaves the LED on. So it
blinks on really quickly before turning off!
Great job! You've edited code in a CircuitPython program!
What if I don't have the loop?
If you don't have the loop, the code will run to the end and exit. This can lead to some unexpected behavior in
simple programs like this since the "exit" also resets the state of the hardware. This is a different behavior than
running commands via REPL. So if you are writing a simple program that doesn't seem to work, you may need to add
a loop to the end so the program doesn't exit.
The simplest loop would be:
while True:
pass
And remember - you can press <CTRL><C> to exit the loop.
See also the Behavior section in the docs.
while True:
led.value = True
time.sleep(0.5)
led.value = False
time.sleep(0.5)
© Adafruit Industries https://learn.adafruit.com/adafruit-metro-m4-express-airlift-wifi Page 41 of 187