Skip to content

Commit

Permalink
it were eliminated some unnecessary lines and GPIO number was added a…
Browse files Browse the repository at this point in the history
…s an input option
  • Loading branch information
Prosimio committed Jul 12, 2018
1 parent e5337c8 commit 4686b53
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
18 changes: 15 additions & 3 deletions Hardware_control/turnOFF.py
@@ -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()
16 changes: 13 additions & 3 deletions Hardware_control/turnON.py
@@ -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)

0 comments on commit 4686b53

Please sign in to comment.