Skip to content

Instantly share code, notes, and snippets.

@dewomser
Created November 14, 2022 20:36
Show Gist options
  • Save dewomser/0e9dc30a8b01fce02238f7108360f2fd to your computer and use it in GitHub Desktop.
Save dewomser/0e9dc30a8b01fce02238f7108360f2fd to your computer and use it in GitHub Desktop.
Positive Flanke vom Schieberegister startet Barcodescanner
#!/usr/bin/env python
import RPi.GPIO as GPIO
import subprocess
# import time
# import os
# adjust for where your switch is connected
buttonPin = 4
GPIO.setmode(GPIO.BCM)
# GPIO.PUD_DOWN funktioniert nicht an pin 3 und 5 weil hardcoded ist UP
# GPIO.setup(buttonPin, GPIO.IN, GPIO.PUD_DOWN)
GPIO.setup(buttonPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
while True:
GPIO.wait_for_edge(buttonPin, GPIO.RISING)
# os.system("/home/karl/barcode.sh")
print(subprocess.run(["/home/karl/barcode.sh"], shell=True))
GPIO.cleanup()
@dewomser
Copy link
Author

typo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment