Advertisement
Guest User

Untitled

a guest
Jan 5th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. from subprocess import call
  2. from time import sleep
  3. from reader import getch
  4.  
  5. ip = raw_input("Enter IP of the receiving machine: ")
  6.  
  7. call (["raspivid -fps 12 -h 192 -w 256 -b 1000000 -n -t 999999 -o - | nc %s 5001" % ip], shell=True)
  8. call (["bash /home/pi/servod.sh"], shell=True)
  9. call (["echo 2=120 > /dev/servoblaster"], shell=True)
  10.  
  11. width = 120
  12. step = int(raw_input("Enter step width 0<x<20: "))
  13.  
  14. print ("Hit f to move forward or b to move backward: ")
  15. while True:
  16.  
  17. user = getch()
  18. if user == "f":
  19. call (["echo 2=+%d > /dev/servoblaster" % step], shell=True)
  20. width += step
  21. elif user == "b":
  22. call (["echo 2=-%d > /dev/servoblaster" % step], shell=True)
  23. width -= step
  24. elif user == "k":
  25. break
  26. else:
  27. print ("Invalid input")
  28. print "\r%d" % width,
  29.  
  30. call (["sudo killall servod"], shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement