blink_the_led
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| blink_the_led [2026/06/12 23:02] – created walkeradmin | blink_the_led [2026/06/17 16:37] (current) – [Introduction] walkeradmin | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| + | The build in pico_led function has a ' | ||
| + | \\ | ||
| + | \\ | ||
| + | Look at the following Micro Python code: | ||
| + | \\ | ||
| + | < | ||
| + | from picozero import pico_led | ||
| + | pico_led.blink(0.5) | ||
| + | </ | ||
| + | |||
| + | If you copy/paste this in to Thonny and run it, you will see that just like our flashing LED example, the LED flashed twice a second. | ||
| + | \\ | ||
| + | \\ | ||
| + | So, why would we use the flashing version, that has multiple lines of code over using the 2 lines of code blinking version?? Well the answer is quite simple: | ||
| + | \\ | ||
| + | \\ | ||
| + | * 1. If you use the blinking version, the code is simple. | ||
| + | |||
| + | * 2. If you use the flashing version, the code is slightly more complex but you get control over the duty cycle, that is you can have the led on longer than it is off, or visa-versa. | ||
| + | \\ | ||
| + | There might be other reasons, I just have not thought about them :) | ||
| + | \\ | ||
| + | \\ | ||
| + | ---- | ||
blink_the_led.1781305357.txt.gz · Last modified: by walkeradmin
