CP code works well, mimicks INO. Need to decide on pin changes...

This commit is contained in:
Mikey Sklar 2018-10-31 17:38:20 -06:00
parent 570296656a
commit 1f0a711c32
2 changed files with 6 additions and 5 deletions

Binary file not shown.

View file

@ -34,16 +34,17 @@ tilt_servo = servo.Servo(tilt_pwm)
rotate_servo = servo.Servo(rotate_pwm)
# servo timing and angle range
speed = .04 # 40ms lower value means faster movement
tilt_min = 120 # lower limit to tilt rotation range
max_rotate = 180 # rotation range limited to half circle
while True:
# servo tilt - on average move every 500ms
if random.randint(100) > 80:
tilt_servo = angle(random.randint(tilt_min, max_rotate))
if random.randint(0,100) > 80:
tilt_servo.angle = random.randint(tilt_min, max_rotate)
time.sleep(.25)
# servo rotate - on average move every 500ms
if random.randint(100) > 90:
rotate_servo = (random.randint(0, max_rotate)
if random.randint(0,100) > 90:
rotate_servo.angle = random.randint(0, max_rotate)
time.sleep(.25)