forked from tdicola/pi-facerec-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservo.py
31 lines (26 loc) · 841 Bytes
/
servo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Raspberry Pi Face Recognition Box Servo Calibration Sketch
# Copyright 2013 Tony DiCola
from RPIO import PWM
import config
servo = PWM.Servo()
print 'Servo Calibration'
print
print 'Use this tool to find the pulsewidth values which move the'
print 'lock latch to the locked and unlocked position. Update config.py'
print 'with the locked and unlocked servo pulsewidth values.'
print
print 'Values range from 1000 to 2000 (in microseconds), with 1500 being the center.'
print
print 'Press Ctrl-C to quit'
print
while True:
val = raw_input('Enter servo pulsewidth (1000 to 2000):')
try:
val = int(val)
except ValueError:
print 'Invalid value, must be between 1000 and 2000!'
continue
if val < 1000 or val > 2000:
print 'Invalid value, must be between 1000 and 2000!'
continue
servo.set_servo(config.LOCK_SERVO_PIN, val)