Skip to content

Commit 43f120b

Browse files
author
Mikey Sklar
committed
Single_Output.py, runs clean, linted, CP and python3 ready
1 parent 8232a96 commit 43f120b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import time
2-
import RPi.GPIO as GPIO
3-
GPIO.setmode(GPIO.BCM)
2+
import board
3+
from digitalio import DigitalInOut, Direction
44

5-
padPin = 23
6-
GPIO.setup(padPin, GPIO.IN)
5+
pad_pin = board.D23
76

7+
pad = DigitalInOut(pad_pin)
8+
pad.direction = Direction.INPUT
89

9-
alreadyPressed = False
10+
already_pressed = False
1011

1112
while True:
12-
padPressed = GPIO.input(padPin)
1313

14-
if padPressed and not alreadyPressed:
15-
print "pressed"
16-
17-
alreadyPressed = padPressed
14+
if pad.value and not already_pressed:
15+
print("pressed")
16+
17+
already_pressed = pad.value
1818
time.sleep(0.1)

0 commit comments

Comments
 (0)