Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
it were eliminated some unnecessary lines and GPIO number was added a…
…s an input option
- Loading branch information
Showing
2 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
from picamera import PiCamera | ||
#to run: python turnOFF.py GPIO_number | ||
#where GPIO_number have to be an integer. e.g. 29 | ||
|
||
import RPi.GPIO as GPIO | ||
import sys | ||
|
||
# Set the GPIO number where LEDs control is conected | ||
if len(sys.argv)==2: | ||
GPIO_num = int(sys.argv[1]) # e.g. Timelapse | ||
|
||
else: | ||
GPIO_num = 29 #GPIO 29 is used as the default | ||
|
||
GPIO.setwarnings(False) | ||
|
||
GPIO.setmode(GPIO.BOARD) | ||
GPIO.setup(29, GPIO.OUT) | ||
GPIO.setup(GPIO_num, GPIO.OUT) | ||
|
||
GPIO.output(29,GPIO.LOW) | ||
GPIO.output(GPIO_num,GPIO.LOW) | ||
|
||
GPIO.cleanup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
from picamera import PiCamera | ||
#to run: python turnON.py GPIO_number | ||
#where GPIO_number have to be an integer. e.g. 29 | ||
|
||
import RPi.GPIO as GPIO | ||
import sys | ||
|
||
# Set the GPIO number where LEDs control is conected | ||
if len(sys.argv)==2: | ||
GPIO_num = str(sys.argv[1]) # e.g. Timelapse | ||
|
||
else: | ||
GPIO_num = 29 #GPIO 29 is used as the default | ||
|
||
GPIO.setmode(GPIO.BOARD) | ||
GPIO.setup(29, GPIO.OUT) | ||
GPIO.setup(GPIO_num, GPIO.OUT) | ||
|
||
GPIO.output(29,GPIO.HIGH) | ||
GPIO.output(GPIO_num,GPIO.HIGH) |