Error message: avrdude: stk500_recv(): programmer is not responding

Hi,
I’m trying to upload my programme to my arduino board and the error message “avrdude: stk500_recv(): programmer is not responding” appears. My board and port seem to be right so have no clue why it isn’t working.

The code was created for a past art project, which I am re-exhibiting. Since then I have a new MacBook Pro, which i transfered my hard drive date from my old Mac book. Could this be affecting it?

The circuit is fairly simple with three bread boards running from six pins on the arduino with a resistor, and output wire running from each one, to detect touch.

I think the main issue at the moment is the error message. Any info would be greatly appreciated, as i’m a bit of a novice with code. Here is my source code… Its a mess but it worked last time i ran the programme a year ago.

int speakerPin = 7;

int length = 15; // the number of notes
char notes[] = "ccggaagffeeddc "; // a space represents a rest
int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };
int tempo = 1;

void playTone(int tone, int duration) {
  for (long i = 0; i < duration * 1000L; i += tone * 2) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(tone);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(tone);
  }
}


void playNote(char note, int duration) {
  char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
  int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };

  // play the tone corresponding to the note name
  for (int i = 0; i < 8; i++) {
    if (names[i] == note) {
      playTone(tones[i], duration);
    } 
  }
}

void playNoteFromCap(int note, int duration) {
  int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };

  // play the tone corresponding to the note name
  for (int i = 0; i < 8; i++) {
      playTone(note, duration);
  }
}



int  i;
int x, y;
int x2, y2;
int x3, y3;
float accum, fout, fval = .07;    // these are variables for a simple low-pass (smoothing) filter - fval of 1 = no filter - .001 = max filter
float accum2, fout2, fval2 = .07;    // these are variables for a simple low-pass (smoothing) filter - fval of 1 = no filter - .001 = max filter
float accum3, fout3, fval3 = .07;    // these are variables for a simple low-pass (smoothing) filter - fval of 1 = no filter - .001 = max filter

void setup() {
 Serial.begin(9600);
  pinMode(speakerPin, OUTPUT);

 //DDRB=B101;     // DDR is the pin direction register - governs inputs and outputs- 1's are outputs
 // Arduino pin 8 output, pin 9 input, pin 10 output for "guard pin"
 //  preceding line is equivalent to three lines below
 pinMode(4, OUTPUT);     // output pin
 pinMode(5, INPUT);      // input pin
 pinMode(6, OUTPUT);     // output pin
 pinMode(7, INPUT);      // input pin
 pinMode(8, OUTPUT);     // output pin
 pinMode(9, INPUT);      // input pin
 //pinMode(10, OUTPUT);    // guard pin
 //digitalWrite(10, LOW);  //could also be HIGH - don't use this pin for changing output though
}


void loop() {
  
 y = 0;        // clear out variables
 x = 0;

 for (i=0; i < 4 ; i++ ){       // do it four times to build up an average - not really neccessary but takes out some jitter

   // LOW-to-HIGH transition
//   PORTB = PORTB | 1;                    // Same as line below -  shows programmer chops but doesn't really buy any more speed
    digitalWrite(8, HIGH);    
   // output pin is PortB0 (Arduino 8), sensor pin is PortB1 (Arduinio 9)                                  

//   while ((PINB & B10) != B10 ) {        // while the sense pin is not high
     while (digitalRead(9) != 1) {     // same as above port manipulation above - only 20 times slower!                
     x++;
   }
   delay(1);

   //  HIGH-to-LOW transition
//   PORTB = PORTB & 0xFE;                // Same as line below - these shows programmer chops but doesn't really buy any more speed
   digitalWrite(8, LOW);              
   //while((PINB & B10) != 0 ){            // while pin is not low  -- same as below only 20 times faster
   while(digitalRead(9) != 0 ) {      // same as above port manipulation - only 20 times slower!
     y++;  
   }

   delay(1);
 }

 fout =  (fval * (float)x) + ((1-fval) * accum);  // Easy smoothing filter "fval" determines amount of new data in fout
 accum = fout;  

// Serial.print( (long)fout, DEC); // Smoothed Low to High
// Serial.print( "  " );

//next
  
 y = 0;        // clear out variables
 x = 0;

 for (i=0; i < 4 ; i++ ){       // do it four times to build up an average - not really neccessary but takes out some jitter

   // LOW-to-HIGH transition
//   PORTB = PORTB | 1;                    // Same as line below -  shows programmer chops but doesn't really buy any more speed
    digitalWrite(6, HIGH);    
   // output pin is PortB0 (Arduino 8), sensor pin is PortB1 (Arduinio 9)                                  

//   while ((PINB & B10) != B10 ) {        // while the sense pin is not high
     while (digitalRead(7) != 1) {     // same as above port manipulation above - only 20 times slower!                
     x++;
   }
   delay(1);

   //  HIGH-to-LOW transition
//   PORTB = PORTB & 0xFE;                // Same as line below - these shows programmer chops but doesn't really buy any more speed
   digitalWrite(6, LOW);              
   //while((PINB & B10) != 0 ){            // while pin is not low  -- same as below only 20 times faster
   while(digitalRead(7) != 0 ) {      // same as above port manipulation - only 20 times slower!
     y++;  
   }

   delay(1);
 }

 fout =  (fval * (float)x) + ((1-fval) * accum);  // Easy smoothing filter "fval" determines amount of new data in fout
 accum = fout;  


// Serial.print( (long)fout, DEC); // Smoothed Low to High
// Serial.print( "  " );


//next
  
 y = 0;        // clear out variables
 x = 0;

 for (i=0; i < 4 ; i++ ){       // do it four times to build up an average - not really neccessary but takes out some jitter

   // LOW-to-HIGH transition
//   PORTB = PORTB | 1;                    // Same as line below -  shows programmer chops but doesn't really buy any more speed
    digitalWrite(4, HIGH);    
   // output pin is PortB0 (Arduino 8), sensor pin is PortB1 (Arduinio 9)                                  

//   while ((PINB & B10) != B10 ) {        // while the sense pin is not high
     while (digitalRead(5) != 1) {     // same as above port manipulation above - only 20 times slower!                
     x++;
   }
   delay(1);

   //  HIGH-to-LOW transition
//   PORTB = PORTB & 0xFE;                // Same as line below - these shows programmer chops but doesn't really buy any more speed
   digitalWrite(4, LOW);              
   //while((PINB & B10) != 0 ){            // while pin is not low  -- same as below only 20 times faster
   while(digitalRead(5) != 0 ) {      // same as above port manipulation - only 20 times slower!
     y++;  
   }

   delay(1);
 }

 fout =  (fval * (float)x) + ((1-fval) * accum);  // Easy smoothing filter "fval" determines amount of new data in fout
 accum = fout;  

 Serial.println( (long)fout, DEC); // Smoothed Low to High



// Serial.print((long)x, DEC);    // raw data - Low to High
// Serial.print( "   ");
// Serial.print((long)y, DEC);    // raw data - High to Low
// Serial.print( "   ");
// Serial.println( (long)fout, DEC); // Smoothed Low to High
 
 //playNoteFromCap((fout-17)*900, 1 * tempo);
 
 
 
 delay(100);
 
}

Thanks for any info or feedback

Think about the error: "programmer is not responding." This means that your problem is not in your code or your computer... it is your arduino, or your usb2serial chip. By chance, would you happen to have anything plugged into pins 0 or 1? This will tie up the ftdi or atmega8u2 chip. Otherwise, check to make sure none of your pins are touching (including power shorts), make sure nothing is touching usb port.

baum