Help with Error message: Problem uploading to board

Hi, I am having problems uploading my sketch to my arduino Uno board with a motor shield attached. This error message comes up:

Sketch uses 4,896 bytes (15%) of program storage space. Maximum is 32,256 bytes.
Global variables use 385 bytes (18%) of dynamic memory, leaving 1,663 bytes for local variables. Maximum is 2,048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xad
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xad
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

Any suggestions on what to do? the code is verified, and I am trying to make a walking fish robot that turns when it gets close to a wall, but I am fairly new to Arduino and would appreciate any help. Here is my code, if that’s need:

#include <Servo.h>

Servo myservoR;
Servo myservoL;
Servo myservoB;
// create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0; // variable to store the servo position
const int trigPin = 1;
const int echoPin = 0 ;

void setup() {
Serial.begin(9600); // begin serial communitication
Serial.println(“Motor test!”);
pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)
myservoL.attach(9);
myservoR.attach(10);
myservoB.attach(11);

}
void loop() {

long duration, distance; // start the scan
digitalWrite(trigPin, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trigPin, HIGH);

delayMicroseconds(10); //this delay is required as well!
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;// convert the distance to centimeters.

if (distance < 25)/*if there’s an obstacle 25 centimers, ahead, do the following: */ {
Serial.println (“Close Obstacle detected!” );
Serial.println (“Obstacle Details:”);
Serial.print (“Distance From Robot is " );
Serial.print ( distance);
Serial.print ( " CM!”);// print out the distance in centimeters.

Serial.println (" DANGER WILL ROBINSON! THAT THING IS IN YOUR WAY! “);
Serial.println (” Turning !");

for (pos = 90; pos >= 0; pos -= 2) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservoL.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}

myservoB.write(100);
delay(2000);
myservoB.write(90);
// Turn as long as there’s an obstacle ahead.

}
else {
{
for (pos = 0; pos <= 90; pos += 2) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservoR.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
myservoB.write(100);
delay(1100);
myservoB.write(90);

for (pos = 90; pos >= 0; pos -= 2) { // goes from 180 degrees to 0 degrees
myservoR.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}

for (pos = 90; pos >= 0; pos -= 2) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservoL.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
myservoB.write(100);
delay(1100);
myservoB.write(90);

for (pos = 0; pos <= 90; pos += 2) { // goes from 180 degrees to 0 degrees
myservoL.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}
}}

Thanks for any help!

Robotcottus.ino (2.99 KB)

I don't think the problem is related to your code.

Have you been able to upload any other program to the same Uno?

I presume you have selected the correct board and port?

It may help to remove the shield from the Uno before uploading the program.

...R

You're using pins 0 and 1. Disconnect during upload might solve the issue.