Skip to content

Instantly share code, notes, and snippets.

@elktros
Last active February 27, 2021 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elktros/10c9a1e564b3d6e51c503ed450711c40 to your computer and use it in GitHub Desktop.
Save elktros/10c9a1e564b3d6e51c503ed450711c40 to your computer and use it in GitHub Desktop.
Demo Blinky Python code for Raspberry Pi Pico.
#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