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

 }

}