forked from BringusStudios/pipico-operation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttonstate.py
More file actions
20 lines (14 loc) · 734 Bytes
/
Copy pathbuttonstate.py
File metadata and controls
20 lines (14 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# This script creates a Pi Pico object and monitors for 'button presses'
# in the form of the user touching the walls of the object chambers.
from picocom import PiPicoCommunicator
# Check device manager under "Ports (COM & LPT)" for a USB Serial Port.
# There might be more than one, so unplug and replug your USB serial adapter
# until you know which port your serial adapter is using. Once you know
# which port it's on, change 'COM11' below to whatever your port is.
pico_communicator = PiPicoCommunicator(port='COM11')
print("Monitoring button state...")
while True:
state_change = pico_communicator.check_state()
if state_change:
print(f"State changed to '{state_change}'")