Skip to content

Instantly share code, notes, and snippets.

@hugodahl
Created July 23, 2022 03:06
Show Gist options
  • Save hugodahl/20cd220cd0eb87a92ccd99fd63131a0b to your computer and use it in GitHub Desktop.
Save hugodahl/20cd220cd0eb87a92ccd99fd63131a0b to your computer and use it in GitHub Desktop.
Simple PICO sketch
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Example for Pico. Blinks the built-in LED."""
import time
import board
import digitalio
import analogio
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
button = digitalio.DigitalInOut(board.GP18)
button.switch_to_input(pull=digitalio.Pull.UP)
while True:
btnValue = button.value
print(f"Button value: {btnValue}")
led.value = btnValue
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment