import RPi.GPIO as GPIO
import time
PORT=4
GPIO.setmode(GPIO.BCM)
GPIO.setup(PORT, GPIO.OUT)
def blink(times, delay):
while times>0:
if 0==times%2:
GPIO.output(PORT, GPIO.HIGH) #or output(PORT, GPIO.True)
else:
GPIO.output(PORT, GPIO.LOW)
time.sleep(delay)
times-=1
return
if __name__ == '__main__':
blink(20, 1)
import time
PORT=4
GPIO.setmode(GPIO.BCM)
GPIO.setup(PORT, GPIO.OUT)
def blink(times, delay):
while times>0:
if 0==times%2:
GPIO.output(PORT, GPIO.HIGH) #or output(PORT, GPIO.True)
else:
GPIO.output(PORT, GPIO.LOW)
time.sleep(delay)
times-=1
return
if __name__ == '__main__':
blink(20, 1)