Skip to content

Instantly share code, notes, and snippets.

@romilly
Last active August 7, 2022 13:49
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 romilly/1e4e0751e6be029880be2f3c60131ff9 to your computer and use it in GitHub Desktop.
Save romilly/1e4e0751e6be029880be2f3c60131ff9 to your computer and use it in GitHub Desktop.
"""
Example for remote control from host via Serial link.
This is the code to run on the Pico.
It sets up the onboard LED and allows you to turn it on or off.
"""
from machine import Pin
# use onboard LED which is controlled by Pin 25
# on a Pico W the onboad lLED is accessed differently,
# so commeent out the line below
# and uncomment the line below that
led = Pin(25, Pin.OUT) # veresion for Pico
# led = Pin('LED', Pin.OUT) # version for Pico W
# Turn the LED on
def on():
led.value(1)
# Turn the LED off
def off():
led.value(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment