Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Unitoi01/c779b7c5bcb1be53b284a99252f5a9c1 to your computer and use it in GitHub Desktop.
Save Unitoi01/c779b7c5bcb1be53b284a99252f5a9c1 to your computer and use it in GitHub Desktop.
New Button.py
#!/usr/bin/python2
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
buttonPin = 4
lightPin=3
GPIO.setup(buttonPin, GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(lightPin, GPIO.OUT)
while True:
GPIO.output(lightPin,GPIO.HIGH)
input=GPIO.input(4)
if input==GPIO.HIGH:
print("it works")
os.system("python /home/pi/Python-Thermal-Printer/print_sound.py")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment