Hi Grog

I have design 2 animatronic eyes that work with 2 servos and Arduino r3 . Please help with a program that let the eyes go left and right and the second servo just let the lids just flip flip . Please

 

GroG

10 years 7 months ago

Should be easy :

1. start an Arduino service (name it arduino)  - connect it to the correct port
2. start a Servo service (name it panEyes) - connect it to the Arduino, with correct pin - test
3. start another Servo service (name it eyelids) - connect it to the Arduino with the correct pin - test

This could all be done from the gui ...

For a Python script which does the same :

arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM7")
panEyes = Runtime.createAndStart("panEyes","Servo")
eyelids = Runtime.createAndStart("eyelids","Servo")
panEyes.attach("arduino", 5)
eyelids.attach("arduino", 7)

# look suspiciously around
panEyes.moveTo(10)
sleep(1)
panEyes.moveTo(160)
sleep(1)
panEyes.moveTo(10)
sleep(1)
panEyes.moveTo(160)
sleep(1)

# look forward and blink
panEyes.moveTo(90)
sleep(1)
eyelids.moveTo(0)
sleep(0.5)
eyelids.moveTo(180)
sleep(0.5)
eyelids.moveTo(0)
sleep(0.5)
eyelids.moveTo(180)
sleep(0.5)