root/525.743/code/test scripts/relay.py @ e45aa19e
| e45aa19e | dsorber | import sys
|
|
import RPIO
|
|||
def main():
|
|||
if len(sys.argv) < 2:
|
|||
print 'Error, you must specify at least one argument'
|
|||
return
|
|||
# Use the BCM addressing scheme
|
|||
RPIO.setmode(RPIO.BCM)
|
|||
# Setup output
|
|||
RPIO.setup(17, RPIO.OUT)
|
|||
if sys.argv[1] == '1':
|
|||
RPIO.output(17, True)
|
|||
print 'Relay on'
|
|||
else:
|
|||
RPIO.output(17, False)
|
|||
print 'Relay off'
|
|||
if __name__ == '__main__':
|
|||
sys.exit(main())
|