flash_the_led_ex1
This is an old revision of the document!
Flash the LED Ex1
Introduction
In our first Micro Python example, we saw how to turn on and off the onboard LED on the Pi Zero. But what is really cool to do is to flash the LED on and off. This means we can use the LED as an indicator of an error, or that something is running etc.
Lets write some more code in Thonny
Here is the full Micro Python code that we are using.
- download
# Import the picozero LED class from picozero import pico_led # Import the time module for delays from time import sleep # Create an LED object for the onboard LED led = pico_led # Run forever while True: # Turn the LED on led.on() # Wait for 0.25 second sleep(0.25) # Turn the LED off led.off() # Wait for 0.25 second sleep(0.25)
flash_the_led_ex1.1781304635.txt.gz · Last modified: by walkeradmin

