You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
656 B
Python

# button setup (connect to 3.3V and GPIO Pin 16)
import RPi.GPIO as GPIO # GPIO pins
import time
import os # library to use bash commands
def print_output(final_module):
while True: # Run forever
GPIO.setmode(GPIO.BOARD) #Use the physical GPIO number
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) #Change pin if necessary
GPIO.setwarnings(False) #Ignore warnings
if GPIO.input(16) == GPIO.HIGH:
time.sleep(1)
# print(final_module)
os.system("lp " + final_module + ".ps") # lp is the bash print command
GPIO.cleanup() #GPIO clean up
else:
break