Tuesday, 19 February 2013

Python Command Code Scripts


Below are the Python command code scripts, the theory is that when a command is pressed on a handheld mobile device a certain sequence of script(s) will run thus executing the command given a distance away over a wireless network.

GPIO_SETUP:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3, GPIO.OUT)
GPIO.setup(5, GPIO.OUT)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)

GPIO_3_HIGH:
import RPi.GPIO as GPIO
GPIO.output(11, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(3, GPIO.HIGH)

GPIO_5_HIGH:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(11, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(5, GPIO.HIGH)

GPIO_7_HIGH:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(11, GPIO.LOW)
GPIO.output(7, GPIO.HIGH)

GPIO_11_HIGH:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(11, GPIO.HIGH)

GPIO_RESET:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(11, GPIO.LOW)

No comments:

Post a Comment