Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pico W à Warcraft, 01: Hello Circuit Python (Install, Thonny, VSCode, Mu et code.circuitpython.org) #108

Open
EloiStree opened this issue Nov 14, 2024 · 0 comments

Comments

@EloiStree
Copy link
Owner

EloiStree commented Nov 14, 2024

image
https://youtu.be/EmjB1322PQA

EloiStree/HelloInput#282

print("Hello World")


import time
import board
import digitalio





# Set up pin 20 as an output
pin20 = digitalio.DigitalInOut(board.GP20)
pin20.direction = digitalio.Direction.OUTPUT

# Set up pin 19 as an output
pin19 = digitalio.DigitalInOut(board.GP19)
pin19.direction = digitalio.Direction.OUTPUT


def turn_on(pin):
    pin.value = True
def turn_off(pin):
    pin.value = False

def set(is_on, delay):
    if is_on:
        print("On")
        turn_on(pin20)
        turn_on(pin19)
    else:
        print("Off")
        turn_off(pin20)
        turn_off(pin19)

    time.sleep(delay)

# Blink the pins in a loop
while True:

    delay =3

    delay =1
    delay =0.08
    delay =0.5

    set(True, delay)
    set(False, delay)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant