Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

General • Re: Pico kit not working as expected.

$
0
0
I would propose to add some print statements which help to understand what is going on:

Code:

import machineimport timeprint("your program is running now")switch = machine.Pin(15, machine.Pin.IN, machine.Pin.PULL_DOWN)LED = machine.Pin("LED", machine.Pin.OUT)while True:    if switch.value():        print("button 1")        LED.value(True)    else:        print("button 0")        LED.value(False)            time.sleep(0.1) # makes loop a bit slower, but thonny can't handle too fast printout
Start the code with the small green icon in thonny:
thonny_run.png
You should see this in 'Shell' view of thonny:
thonny_running.png

Statistics: Posted by ghp — Tue Feb 24, 2026 9:40 pm



Viewing all articles
Browse latest Browse all 8037

Trending Articles