Uploading Error: exit status 1

Hello,
Total newbie here. Trying to upload to Arduino Nano (1.8.6) and getting the below error. Code is below that. Sorry if my code isn't formatted correctly. Thanks for any help!

Sketch uses 15218 bytes (49%) of program storage space. Maximum is 30720 bytes.
Global variables use 926 bytes (45%) of dynamic memory, leaving 1122 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe9
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe9
Failed uploading: uploading error: exit status 1

/**
 * Take Me Home
 * 
 * A GPS-enabled portable "reverse geocache" puzzle that requires a portable puzzle
 * to be taken to a specific real-world location. On arrival, a function is triggered
 * that can, e.g. release a maglock, display a message etc.
 */

// DEFINES
// When defined, prints additional debugging information to USB serial connection
#define DEBUG

// INCLUDES
// GPS sensor uses a (software) serial connection - this library is better than SoftwareSerial
#include "src/AltSoftSerial/AltSoftSerial.h"
// GPS library makes it easier to pass NMEA data sent from the GPS module
#include "src/TinyGPSPlus-1.0.2/TinyGPS++.h"
// Wire is a generic Arduino library for connection to any I2C devices
#include <Wire.h>
// LCD display library
#include "src/LiquidCrystal_PCF8574/LiquidCrystal_PCF8574.h"

// CONSTANTS
// Define the lat/long of the target location
// This can be found by going to Google Maps/Open Street Map, right-clicking a location and selecting "What's Here/Show Address"?
static const double targetLatitude = 52.22855, targetLongitude = 1.29832;
// Acceptable distance (in metres) from target that needs to be attained
const unsigned long targetProximity = 10;
// This pin will be (briefly) driven HIGH when the device is within proximity of the target location
const byte relayPin = 3;

// GLOBALS
// Initialise the LCD display with the specified I2C address.
// Common I2C addresses for a 16x2 character LCD screen are 0x27 and 0x3f
LiquidCrystal_PCF8574 lcd(0x3f);
// Instantiate the TinyGPS++ object
TinyGPSPlus gps;
// Create an emulated serial connection to the GPS device - AltSoftSerial uses pins RX 8, TX 9
AltSoftSerial SoftSerial;

void setup() {

#ifdef DEBUG
  // Begin H/W serial connection to show debug info on the Arduino Serial Monitor
  Serial.begin(9600);
  Serial.println(F("Entering setup"));
  Serial.print(F("Initialising LCD..."));
#endif

  // Initialise the LCD
  lcd.begin(16, 2);
  lcd.setBacklight(255);
  delay(100);
  lcd.home();
  lcd.print("Take Me Home");
  lcd.setCursor(0, 1);
  lcd.print("v1.0");
  delay(100);

#ifdef DEBUG
  Serial.println(F("done!"));
  Serial.print(F("Initialising GPS"));
#endif

  // Begin S/W serial connection for GPS connection
  SoftSerial.begin(9600);
  delay(100);
#ifdef DEBUG
  Serial.println(F("done"));
#endif

  // Configure the output pin
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, LOW);
}

void loop() {

  // If we have received a valid location from the GPS module
  if (gps.location.isValid()) {

    // Arduino printf doesn't support floating point values
    // So use the dtostrf function to convert floating point numeric coordinates to char[8] strings
    char latitude[8];
    char longitude[8];
    // Convert coordinates to width of 7, with 4 d.p.
    dtostrf(gps.location.lat(), 7, 4, latitude);
    dtostrf(gps.location.lng(), 7, 4, longitude);

    // Build up a string representation of the location
    char line[16];
    memset(line, 0, sizeof line);
    snprintf(line, 16, "%s%s", latitude, longitude);

    // Clear the LCD display
    lcd.clear();
    lcd.home();
    // Write the location to the top line
    lcd.print(line);
// And, if debugging enabled, write to the serial output too
#ifdef DEBUG
    Serial.println(line);
#endif

    // Calculate the distance to the target location
    unsigned long distToTarget = (unsigned long)TinyGPSPlus::distanceBetween(
      gps.location.lat(),
      gps.location.lng(),
      targetLatitude,
      targetLongitude);
    // Write the distance to the line var
    memset(line, 0, sizeof line);
    snprintf(line, 16, "%ldm to go", distToTarget);

    // Write the distance to the second line
    lcd.setCursor(0, 1);
    lcd.print(line);
// And, if debugging enabled, write to the serial output too
#ifdef DEBUG
    Serial.println(line);
#endif

    // This is the section of code which executes if we're within proximity
    // of the target
    if (distToTarget < targetProximity) {
      // Write a message to the display
      lcd.clear();
      lcd.home();
      lcd.print("CONGRATULATIONS");
      lcd.setCursor(0, 1);
      lcd.print("Treasure found!");

      // Or, play a sound
      tone(4, 440, 1000);

      // Or, release a maglock
      digitalWrite(relayPin, HIGH);
      nonBlockingDelay(100);
      digitalWrite(relayPin, LOW);

      // And wait a bit for continuing
      nonBlockingDelay(2000);
    }
  }

  // This is the section of code if we cannot obtain a valid location
  else {
    // Clear the LCD display
    lcd.clear();
    lcd.home();

    // Build up a string for the display
    char line[16] = "Where am I?";
    // Write the location to the top line
    lcd.print(line);
    // Move to the next line
    lcd.setCursor(0, 1);
    // Clear the character array
    memset(line, 0, sizeof line);
    // Create a line of increasing dots
    static int n = 0;
    for (int i = 0; i < n; i++) {
      line[i] = '.';
    }
    n++;
    // If we reach the end of the the line, start again
    if (n > 15) { n = 0; }
    // Draw the dots on the second line of the display
    lcd.print(line);
  }
  // We don't use a regular "delay()" as we don't want to miss incoming GPS data
  nonBlockingDelay(1000);

#ifdef DEBUG
  // If we've not received any data in the last 5 seconds
  if (millis() > 5000 && gps.charsProcessed() < 10) {
    Serial.println(F("No GPS data received: check wiring"));
  }
#endif
}

// Calling this function instead of normal delay() ensures that incoming data from the GPS module
// is still read even while the rest of code execution is paused
static void nonBlockingDelay(unsigned long ms) {
  unsigned long start = millis();
  do {
    while (SoftSerial.available()) {
      gps.encode(SoftSerial.read());
    }
  } while (millis() - start < ms);
}

This error is usually caused by using an MCU not original from Arduino, which require a different driver from what is downloaded along with the Arduino program.
Basically, if this is the problem, you need to install a driver that suits your MCU.
Usually you need to download a driver for CH340, which can be easily found on the internet.

Thanks! I switched the processor to AtMega328P (Old Bootloader) and that did the trick!

1 Like

No, the driver only is only relevant for the detection of the board. As @CWilli showed, selecting the correct bootloader affects the actual upload.

@CWilli, you can mark a tropic as solved by clicking the solution button under the most useful reply (yours in this case). That way people don't spend time trying to help you and others that have the same problem and find the topic know that there isa possible solution for their problem.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.