Go Down

Topic: Servo example not uploading/problem (Read 898 times) previous topic - next topic

ServoTech

I am trying to control a simple servo. I am going off this site to help me http://www.azega.com/arduino-servo-motor-part-1/ and I have it wired up just like in the picture. I am using the code from File>Examples>Servo>Sweep  I haven't modified the code at all. It compiles successfully but when I try to upload this shows up-
avrdude: stk500_getsync(): not in sync: resp=0x30
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Anyone know what the problem is and how I can fix it?

Any replies will be well appreciated, Thank You. Here's the code if anyone need to look at it.

// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.


#include <Servo.h>

Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created

int pos = 0;    // variable to store the servo position

void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}


void loop()
{
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

spycatcher2k

disconnect usb - unhook servo - plug in usb - upload sketch - unhook usb - hook up servo - plug in usb


If this does not work its not a servo issue, let us know what happens.



Drew.
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

retrolefty

Quote
I am trying to control a simple servo. I am going off this site to help me http://www.azega.com/arduino-servo-motor-part-1/ and I have it wired up just like in the picture. I am using the code from File>Examples>Servo>Sweep  I haven't modified the code at all. It compiles successfully but when I try to upload this shows up-
avrdude: stk500_getsync(): not in sync: resp=0x30
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51



That is an upload error, nothing to do with the sketch or the servo. That error means the Arduino IDE can't communicate with the board. Can you upload anything, like the simple blink example? Some common causes for that error are:

Not selecting proper comm port number in the arduino IDE
Not selecting the proper board type in the Arduino IDE
Not installing the PC USB serial driver software properly

Lefty

spycatcher2k

or its a faulty servo pulling loads of current from the arduino. Been there myself  :smiley-eek:
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

retrolefty


or its a faulty servo pulling loads of current from the arduino. Been there myself  :smiley-eek:


Yes, could be. That's why I asked if he had ever uploaded blink succesfully. If so he could just unwire the servo and see if he can then upload OK or not. We will just have to wait for his response(s).

Lefty

ServoTech


disconnect usb - unhook servo - plug in usb - upload sketch - unhook usb - hook up servo - plug in usb


I've tried this and the upload error continued to show up.

I also tried uploading the simple blink example and the error still proceeded.

So next I think I should try the options below. How do I know if I've done them correctly or done them at all? and if No how do I?


Quote

Not selecting proper comm port number in the arduino IDE
Not selecting the proper board type in the Arduino IDE
Not installing the PC USB serial driver software properly



Thank You for all your responses! I am destine to figure this out!

retrolefty

http://arduino.cc/en/Guide/Troubleshooting

Go Up