Created
July 23, 2022 03:06
-
-
Save hugodahl/20cd220cd0eb87a92ccd99fd63131a0b to your computer and use it in GitHub Desktop.
Simple PICO sketch
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
# 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