Let's Make Robots!

AHA Moment

Ok so I finally had an AHA moment about why my servos "weren't working". My servos would just jerk and not do much. I tried my perf board that I wired up for my manual transmission robot. I tried a 28x1 project board with the same result. Well tonight I finally figured it out.

It was code. (prepare to laugh) Between servo commands I was using sleep 100. I was assuming this was 100 milliseconds. It is actually something like 200 seconds. I changed them to wait 1 (which is wit one second) and they now work. 

I wanted to admit my mistake so others learn that you shouldnt always assume your code isnt the problem. My code looks very simple, but since  I didn't fully understand the sleep command and it wasted me hours of tinkering. Always double check your code (line by line and UNDERSTAND it) and check your wiring.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I had a million of these moments!! :D

And yes, you are right, one learn to ask the right questions!

I just got a high-torque servo tonight. It may work to shift the battery about in my biped (which I may ressurect this w/e).

Could I get the servo to shift? Nah. Than after about an hour I remembered that the last thing I had coded was an "enable" bit for each servo output to save power...

D'oh. The outputs are disabled unless explicitly enabled. 

You need a wait after the servo,0,100 command. Otherwise it will jump to the servo 0,150 at once and move back to 150.

yep...there's a missing wait command before the 'goto'.


you can also use the PAUSE command to work in milliseconds...so PAUSE 1000 would be equivalent to WAIT 1

Thats what got me in trouble I assumed sleep was the same as pause and I made it sleep for 3 minutes between commands.