raspberry
This commit is contained in:
1 parent
84dfdf5210
commit
be436085b3
55 files changed
+2195
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
# for GPIO numbering, choose BCM
|
||||
#GPIO.setmode(GPIO.BCM)
|
||||
|
||||
# or, for pin numbering, choose BOARD
|
||||
GPIO.setmode(GPIO.BOARD)
|
||||
|
||||
GPIO.setmode(GPIO.BOARD) # sets numbering system of GPIO pins
|
||||
channel1 = 15 # Replace MY_BOARD_PIN_ID with your actual pin number
|
||||
channel2 = 16 # Replace MY_BOARD_PIN_ID with your actual pin number
|
||||
|
||||
GPIO.setup(channel1, GPIO.IN) # set the GPIO pin as an input
|
||||
GPIO.setup(channel2, GPIO.IN) # set the GPIO pin as an input
|
||||
|
||||
# then some code where you read the input as many times as needed:
|
||||
while(True):
|
||||
value1 = GPIO.input(channel1)
|
||||
value2 = GPIO.input(channel2)
|
||||
print("1:%d\n"%value1)
|
||||
print("2:%d\n"%value2)
|
||||
time.sleep(0.5)
|
||||
Reference in new issue
Block a user