I have a simple python script :
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
from time import *
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(26,GPIO.IN)
GPIO.setup(4, GPIO.OUT)
while True:
sleep (1)
input = GPIO.input(26)
if input:
GPIO.output(4,True)
else:
GPIO.output(4,False)
Should I avoid switching on a GPIO Pin every second or should I only switch it once the button changes its return value? I switch a LED on and off.