Last active
February 27, 2021 10:00
-
-
Save elktros/10c9a1e564b3d6e51c503ed450711c40 to your computer and use it in GitHub Desktop.
Demo Blinky Python code for Raspberry Pi Pico.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Import Pin class from machine library to configure GPIO Pins. | |
from machine import Pin | |
#Import utime library to implement delay | |
import utime | |
#create an object of Pin class and set GPIO Parameters (GPIO Pin, Direction). | |
led_gpio16 = Pin(16, Pin.OUT) | |
#Create an infinite loop. This is similar to while(1) in C. | |
while True: | |
#Set value to 1 to turn ON LED. | |
led_gpio16.value(1) | |
#sleep_ms function provides delay in milliseconds. | |
utime.sleep_ms(100) | |
#Set value to 0 to turn OFF LED. | |
led_gpio16.value(0) | |
#Provide another 100ms delay to see the LED Blinking. | |
utime.sleep_ms(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment