Let's Make Robots!

Getting error when uploading code to arduino

I purchased the all in one kit from DFRobots that includes the ROMEO Microcontroller (ATMega 328). I try uploading the object avoid code into the Arduino IDE and I get this error:

avrdude stk500_recv programmer is not responding

 

I've searched and know I'm choosing the correct board and serial. In fact I've tried them all and get the same error. I've even changed the usb cable and same results. Others who have had this error say the board could be bad, I'm hoping thats not the case, any suggestions would help.

 

Below is my code I found:

 

 

OBJECT AVOIDING ROBOT CODE FOR ARDUINO - ADAFRUIT MOTORSHIELD - PARALLAX PING )) - TAMIYA DUAL MOTOR GEARBOX

 

CODE ADAPTED, COPIED, MODIFIED, AND STOLEN IN GENERAL FROM VARIOUS PLACES AROUND THE INTERNET BY GRINAN BARRETT JULY 4TH/5TH 2008

 

THIS CODE IS FREE TO ANYONE THAT WISHES TO USE IT, MODIFY IT, OR STEAL IT IN GENERAL.. HAVE FUN WITH IT!

 

This code will let you program a bot that will roam around looking for things to avoid running into.  The code is pretty simple, but gave me major fits figuring out.  Espeically the interaction with the 

the parallax ping )) ultrasonic range finder.  The main thing to remember is the intialization of the ping unit.. it has to be exact.. once i saw i was running to tight a loop on it.. things got much easier.. ( thanks collin)

if nothing else, this code will let you have the basics of a roving bot with ping capability, it's up to you to do cool stuff with it.

 

*/

 

byte ultraSoundSignal = 14;

unsigned long dist = 0;

 

// ***************************   SETTING UP THE PROGRAM  *********************************** 

void setup()

{

 Serial.begin(9600); 

 //motor.setSpeed(200);          // sets motor 1 speed to 200

 //motor2.setSpeed(200);          // sets motor 2 speed to 200

 

 pinMode(ultraSoundSignal, OUTPUT);  // sets enable as output

 

 straight();                    // initializes go straight

}

 

// ***************************   MAIN PROGRAM LOOPS  *********************************** 

void loop() {

distCalc();                                

avoidObjects();                             

delay(20);    

Serial.println(dist);  //     ADDED TO APPEND DISTANCE TO SERIAL MONITOR SO I COULD SEE PROBLEMS.. 

delay(250); 

}

// ***************************   MAIN STRAIGHT ROUTINE  *********************************** 

void straight(){

  //motor.run(FORWARD);

  //motor2.run(FORWARD);

  Serial.print("Forward Hoooo!");  // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR

}

// ***************************   MAIN TURNING ROUTINE  *********************************** 

void turnRight() 

{

   //motor.run(BACKWARD);

   //motor2.run(FORWARD);

   Serial.print("Turning Right!!");// ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR

}

 

// ***************************   PING FUNCTIONS TO GET DISTANCES  *********************************** 

float distCalc() // distance calculating function converts analog input to inches

{

 pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output

 digitalWrite(ultraSoundSignal, LOW); // Send low pulse

 delayMicroseconds(2); // Wait for 2 microseconds

 digitalWrite(ultraSoundSignal, HIGH); // Send high pulse

 delayMicroseconds(5); // Wait for 5 microseconds

 digitalWrite(ultraSoundSignal, LOW); // Holdoff

 pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input

 digitalWrite(ultraSoundSignal, HIGH); // Turn on pullup resistor

 

 unsigned long echo = pulseIn(ultraSoundSignal, HIGH); //Listen for echo

 dist = (echo / 58.138) * 0.39; //convert to CM then to inches

 

 return dist;

}

 

// ***************************   THE AVOIDING OBJECTS ROUTINE  *********************************** 

void avoidObjects()

{

 if(dist < 8)                            // if the distance is less than 8 inches

 {

   Serial.print("object detected closer than allowed!!!");   // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR

   turnRight();                            // turns right using turnRight function

   delay(100);

 }

 else                                      // otherwise

 {

   straight();                            // go straight using the straight function

   Serial.print(" continuing forward ");  //  ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR

 }

}


Comment viewing options

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

I showed the vendor this thread with everyones post and they believe there is an issue with the device. So I'm sending it back to get it replaced. Thanks everyone for your help!!

I own a RoMeo board and had a similar issue. The board is well designed but the assembling quality is low. In my case there was a short cut between the USB connector and the PCB. I could solve the problem by resoldering the USB connector.

Disconnect anything attached to the board, sensors, servos, motors.

Did the red power LED turn on when you plugin the USB cable?

Do you have a multimeter and a soldering iron?

I tried using my daughters laptop running XP and now I get this error:

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

I'v tried everything on the official arduino website here and nothing worked:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248528012/all

You think the board is bad?

Ok, try COM ports and just in case try with a different USB cable, I'm 70% sure that this is the elefant.

This is what shows on my mac: Tools>> Serial Port>>

/dev/tty.usbserial-A600eu14

Been through this already and it doesnt work. You say you have a MBP right? Does it recognize the arduino, I have two boards a mega 2560 and this troublesome (atmega 328)romeo. It ONLY recognizes the mega 2650.

Recognizes the uno, duemilanove( atmega 328) and even a borrow mega 2650 ADK ( Android).

Double post, sorry.

Same error

The board is attached to a battery pack, I wasnt sure if I should turn that on in addition to it being powered via USB. Will it harm the board?

I can’t see why. And it’s worth a try.