Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from subprocess import call
- from time import sleep
- from reader import getch
- ip = raw_input("Enter IP of the receiving machine: ")
- call (["raspivid -fps 12 -h 192 -w 256 -b 1000000 -n -t 999999 -o - | nc %s 5001" % ip], shell=True)
- call (["bash /home/pi/servod.sh"], shell=True)
- call (["echo 2=120 > /dev/servoblaster"], shell=True)
- width = 120
- step = int(raw_input("Enter step width 0<x<20: "))
- print ("Hit f to move forward or b to move backward: ")
- while True:
- user = getch()
- if user == "f":
- call (["echo 2=+%d > /dev/servoblaster" % step], shell=True)
- width += step
- elif user == "b":
- call (["echo 2=-%d > /dev/servoblaster" % step], shell=True)
- width -= step
- elif user == "k":
- break
- else:
- print ("Invalid input")
- print "\r%d" % width,
- call (["sudo killall servod"], shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement