i need a GPIO to turn the display on off ,where can i add the code ???
where can i add that???i found that to shut the Display on and off with a GPIO Pin i'm not real in programming and so on
#Prellzeit in Sekunden
KEY_BOUNCE_TIME=2
GPIO-Pin des Tasters
PinButton=14
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(PinButton,GPIO.IN)
DisplayOn=True
while True:
time.sleep(0.1)
print(GPIO.input(PinButton))
if GPIO.input(PinButton)==0: #Taste wird gedrückt, wg. Pull-Up Widerstand beim Wert 0 DisplayOn=not DisplayOn if DisplayOn==True: print("Bildschirm EIN") else: print("Bildschirm AUS") #Prelldauer für Taster warten time.sleep(KEY_BOUNCE_TIME)
GPIO.cleanup()
sys.exit()
0
Comments
That looks like a Python script to me. Not sure whether Android will support that out-of-the box. Probably not.
The easiest way would be creating a shell script with the same functionality and starting it at boot time.