Skip to content

Instantly share code, notes, and snippets.

@romilly
Last active August 7, 2022 13:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
"""
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