error on uploading;
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfb
i had my code verified(compiled) with no error but on uploading to arduino its showing above message .can anybody help me
my code is -
#define ECHOPIN1 5// Pin to receive echo pulse1
#define TRIGPIN1 6
#define ECHOPIN2 3 // Pin to receive echo pulse2
#define TRIGPIN2 4
int pos = 0; // variable to store the servo position
void setup() {
Serial.begin(9600);
pinMode(ECHOPIN1, INPUT);
pinMode(TRIGPIN1, OUTPUT);
pinMode(ECHOPIN2, INPUT);
pinMode(TRIGPIN2, OUTPUT);
}
void Print (int R , int T)
{
Serial.print(R);Serial.print(", ");
Serial.print(T);Serial.println(".");
delay(100);
}
float Distance1 () {
digitalWrite(TRIGPIN1, LOW);
delayMicroseconds(2);
digitalWrite(TRIGPIN1, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGPIN1, LOW);
// Distance Calculation
float distance1 = pulseIn(ECHOPIN1, HIGH);
return distance1 / 74 / 2; // in inches
}
float Distance2 () {
digitalWrite(TRIGPIN2, LOW);
delayMicroseconds(2);
digitalWrite(TRIGPIN2, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGPIN2, LOW);
// Distance Calculation
float distance2 = pulseIn(ECHOPIN2, HIGH);
return distance2 / 74 / 2; // in inches
}
void loop() {
for (pos=1;pos<100;pos++){
delay(1000);
if ( Distance1()<500){
Print(Distance1() , pos);
}
delay(100);
if ( Distance2()<500){
Print(Distance2() , pos);
delay(100);
}
}
}