Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

How to move two servos at the same time using pyfirmata, python and Arduino

$
0
0

I am trying to program a robot arm and I need two servos to run at the same time and be able to run in different directions for example on going 90° to 180° and the other servo going 90° to 0° , I am using a Arduino, python and pyfirmata any help would be good thank you!

import pyfirmataimport timeboard = pyfirmata.Arduino('/dev/cu.usbmodem14201')armlower2 = board.get_pin('d:6:s')armlower1 = board.get_pin('d:10:s')for angle in range(90, 180, 1):    armlower2.write(angle)    time.sleep(0.015)for angle in range(180, 90, -1):    armlower2.write(angle)    time.sleep(0.015)for angle in range(90, 0, -1):    armlower1.write(angle)    time.sleep(0.015)for angle in range(0, 90, 1):    armlower1.write(angle)    time.sleep(0.015)

This moves the servos but only one at a time ?


Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>