#!/usr/bin/env python
#coding: utf8
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
# Pin 7 (GPIO 04) as Output
GPIO.setup(7, GPIO.OUT)
# Output 3 times On/oFF
i = 3
while i > 0:
# Shutdown output
GPIO.output(7, GPIO.HIGH)
# wait 2 seconds
time.sleep(2)
# Shutdown output
GPIO.output(7, GPIO.LOW)
# wait to seconds
time.sleep(2)
# Count down
i = i - 1
# Free
GPIO.cleanup()
The problem is this programm activate only my Laser 3 times. I want to add my button into it.. if push to the button should my laser go on. How can i do it ? My button is on GPIO 17
Comments
Post a Comment