How to run two continuous servos independently?

Microsoft's MakeCode platform for easy blocks-style programming

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kairyth
 
Posts: 2
Joined: Tue Apr 05, 2016 11:52 pm

How to run two continuous servos independently?

Post by kairyth »

I'm stuck! I can't figure out how to get two continuous rotation servos to turn independently at the same time.

I'm using a Gemma M0 to control the whole thing and coding in MakeCode because it is so much easier and less intimidating than the Arduino IDE.

The big picture goal is to have a string of Neopixels flickering while two continuous rotation servors are turning one way for a certain amount of time, then the other way. I'm trying to make a dress that has a light-up petticoat, with a hemline that lifts and lowers using the servos. To try to make the effect look more random, I wanted the two servos to run separately on their own pins.
https://makecode.com/_gu9Rc49LXM4A

Ive tried using two FOREVER loops, but the best I can get with that is that the lights work and two motors to turn identically using one control pin (so I know I have enough power to run both motors at the same time, I've wired in a 6V battery pack to run the motors). The motors don't want to work in different FOREVER loops.

I've tried using the RUN IN PARALLEL block, but that doesn't work. Only one motor turns. As soon as it gets to the end of that block, the red light on the Gemma starts flashing and that motor just keeps turning in one direction.
MakeCode sketch
MakeCode sketch
Screen Shot 2023-03-30 at 10.57.44 AM.png (947.15 KiB) Viewed 885 times
I can't even get it to run one motor followed by the other motor. The first motor rotates one way, then the other, then just keeps going, again with the red light flashing on the Gemma.

What am I missing?

Thank you!!

User avatar
johnpark
 
Posts: 985
Joined: Wed Mar 25, 2009 2:15 pm

Re: How to run two continuous servos independently?

Post by johnpark »

Does this work if you connect a couple of regular LEDs to pins D0 and D1 to ground?
Screenshot 2023-04-07 at 7.51.33 AM.jpg
Screenshot 2023-04-07 at 7.51.33 AM.jpg (62.62 KiB) Viewed 851 times

Locked
Please be positive and constructive with your questions and comments.

Return to “MakeCode”