raspberry

This commit is contained in:
Lucas Faber authored and Lucas Vivohost committed 2026-09-14 09:20:47 +02:00
1 parent 84dfdf5210
commit be436085b3
55 files changed
+2195

No files matched your search

+22
View File
@@ -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)