Go Down

Topic: Getting my second servo to work (Read 1 time) previous topic - next topic

nitromt2

MarkT, I'm sorry I'm not really sure how to clear the serial buffer do I use while
Code: [Select]
(Serial.available())
  Serial.read();

And by promting you mean I should get rid of
Code: [Select]
Serial.println("Press 4 to turn Arduino pin 4 servo to 180 or 6 to turn it to 0:");  // goes from 0 degrees to 180 degrees
and just combine it with the first serial.println?
Thanks.

MAS3

What if you try to control the first servo by anything else than "0" and "1" ?
So what if you test for "2" and "3", and what if you press wrong keys ?
And do you need to read serial, then control servo 1, and then read serial again and control servo 2 ?
Or is reading serial and then controlling the corresponding servo also an option ?
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

nitromt2

If I control the first servo with anything else then 1 or 0 nothing happens. I have now plugged in my first servo in to pin 4 which I was using for my second servo and I discoverd if I press 4 and 6 then the servo does work. So I think that the arduino board just can't or doesn't want to control the other servo (its a different brand). Reading the serial and then controlling the corresponding servo is a option. Thanks for the reply

nitromt2

Ok I just grabbed a servo from an RC car and this one does work so now both servos are working :) one thing though when I write 1, 0, 4, or 6 I have to type it then send it and then type it and send it again for it to respond. Any ideas?

AWOL

Use a proper terminal emulator, like hyperterm or putty
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

nitromt2

#20
May 09, 2013, 02:34 pm Last Edit: May 09, 2013, 02:46 pm by nitromt2 Reason: 1
I'm using putty now and I still have that same problem. Could it be that I have this running for my second servo? :
Code: [Select]
while (!Serial.available());   // stay here so long as COM port is empty [/s]
Nevermind this part wasn't the problem.

Go Up