Uploading to Raspberry Pi Pico gives me an uploading error: exit status 1

#include <Servo.h>
Servo ESC;
int integ , dervi , last ;
int i, s[14], suma,sgain, deriv, line, vitezaMotorD, vitezaMotorS, dirmotorR, dirmotorL,dr,st;
long int sgaint;
unsigned char kp = 1.40, ki = 0.75, kd = 1.15, basespeed = 100;
boolean start=0;

void setup() 
{
  pinMode(22, OUTPUT);
  pinMode(21, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(27, OUTPUT);
  pinMode(2, INPUT);
  pinMode(4, INPUT);
  pinMode(3, INPUT);
  pinMode(5, INPUT);
  pinMode(6, INPUT);
  pinMode(7, INPUT);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  pinMode(10, INPUT);
  pinMode(11, INPUT);
  pinMode(12, INPUT);
  pinMode(13, INPUT);
  pinMode(14, INPUT);
  pinMode(15, INPUT);
  pinMode(18, INPUT); //start/stop module
  pinMode(20, OUTPUT);
  Serial.begin(9600);
  digitalWrite(21,LOW);
  digitalWrite(27,LOW);
  ESC.attach(20,1000,2000);
  ESC.write(0);
  delay(1200);
}

void loop() 
{ 
  start=digitalRead(18);
  if(start==HIGH)
 { 
  ESC.write(60);
  s[1] = digitalRead(2);
  s[2] = digitalRead(3);
  s[3] = digitalRead(4);
  s[4] = digitalRead(5);
  s[5] = digitalRead(6);
  s[6] = digitalRead(7);
  s[7] = digitalRead(8);
  s[8] = digitalRead(9);
  s[9] = digitalRead(10);
  s[10] = digitalRead(11);
  s[11] = digitalRead(12);
  s[12] = digitalRead(14);
  s[13] = digitalRead(13);
  s[14] = digitalRead(15);
  if (s[14] == 1 || s[13] == 1)
  {
    dr = 0;
    st = 1;
  }
  if (s[1] == 1 || s[2] == 1)
  {
    dr = 1;
    st = 0;
  }

  suma = s[1] + s[2] + s[3] + s[4] + s[5] + s[6] + s[7] + s[8] + s[9] + s[10] + s[11] + s[12] + s[13] + s[14];
  sgain = s[1] * 10 + s[2] * 20 + s[3] * 30 + s[4] * 40 + s[5] * 50 + s[6] * 60 + s[7] * 70 + s[8] * 80 + s[9] * 90 + s[10] * 100 + s[11] * 110 + s[12] * 120 + s[13] * 130 + s[14] * 140;
  if (suma == 0)
  {
    if (dr == 1 && st == 0)
    {
      line = 70;
    }
    if (st == 1 && dr == 0)
    {
      line = -70;
    }
  }
  else
  {
    line = sgain / suma;
    line = 70 - line;
  }
  deriv = line - last;
  if(deriv>150)  {deriv=last;}
  if(deriv<-150)  {deriv=last;}
  integ = line + last;
  if(integ>150)  {integ=last;}
  if(integ<-150) {integ=last;}
  last = line;

  if (line != 0) 
  {
  vitezaMotorS = basespeed - (line * kp + integ * ki + deriv * kd); 
  vitezaMotorD = basespeed + (line * kp + integ * ki + deriv * kd);
  
  if(vitezaMotorD>30)
  {
    digitalWrite(21,LOW);
  }
  if(vitezaMotorD<30)
  {
    vitezaMotorD=(basespeed - (line * kp + integ * ki + deriv * kd))/6;
    digitalWrite(21,HIGH);
  }
    if(vitezaMotorS>30)
  {
    digitalWrite(27,LOW);
  }
  if(vitezaMotorS<30)
  {
    vitezaMotorS=(basespeed + (line * kp + integ * ki + deriv * kd))/6;
    digitalWrite(27,HIGH);
  }
  }
  if (line == 0) 
  {
  vitezaMotorS = 225;
  vitezaMotorD = 225;    
  digitalWrite(27,LOW);
  digitalWrite(21,LOW);
  }
  if (vitezaMotorS > 255) {
    vitezaMotorS = 255;
  }
  if (vitezaMotorS < 0) {
    vitezaMotorS = 0;
  }
  if (vitezaMotorD > 255) {
    vitezaMotorD = 255;
  }
  if (vitezaMotorD < 0) {
    vitezaMotorD = 0;
  }
  analogWrite(22, vitezaMotorS);
  analogWrite(28, vitezaMotorD);
 }

 if 
(start==LOW)
 {
 ESC.write(0);
  analogWrite(22, 0);
  analogWrite(28, 0);
  digitalWrite(27,LOW);
  digitalWrite(21,LOW);
 }
}

Hi @forza_traby77. I'm going to ask you to provide the full output from an upload attempt.


:red_exclamation_mark: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Attempt an upload, as you did before.
  2. Wait for the upload to fail.
  3. You will see an "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  4. Open a reply here on this forum topic by clicking the "Reply" button.
  5. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  6. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the error output from the upload into the code block.
  7. Move the cursor outside of the code block markup before you add any additional text to your reply.
  8. Click the "Reply" button to publish the post.
Sketch uses 97458 bytes (4%) of program storage space. Maximum is 2097152 bytes.
Global variables use 44488 bytes (16%) of dynamic memory, leaving 225848 bytes for local variables. Maximum is 270336 bytes.
.....................
Failed uploading: uploading error: exit status 1

This error might be caused by having the wrong port selected from the Tools > Port menu in Arduino IDE.

Please perform this experiment to verify that the port you have selected is your Arduino board:

  1. Connect the Arduino board to your computer with a USB cable (if it is not already).
  2. Select Tools > Port from the Arduino IDE menus. If one of the ports in the menu is labeled with the board name (e.g., "COM42 (Raspberry Pi Pico)"), that is the port of your Arduino board.

If you saw the port labeled with the board name in the Tools > Port menu, select that port and try uploading again.

If this doesn't solve the problem, please reply here on this forum topic with the answers to the following questions:

  • While following those instructions, did you see a port in the Tools > Port menu that was labeled with the board name?
  • If you did see a labeled port, was the upload successful after you selected that port?

After it uploads and opens the RPI-RP2 folder, it tells me that the Raspberry is no longer connected, although I checked before uploading and it was connected

I'm going to ask you to provide the full verbose output from an upload attempt.


:red_exclamation_mark: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Uncheck the box next to Show verbose output during: compile in the "Preferences" dialog.
  3. Check the box next to Show verbose output during: ☐ upload.
  4. Click the "OK" button.
    The "Preferences" dialog will close.
  5. Attempt an upload, as you did before.
  6. Wait for the upload to fail.
  7. You will see an "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  8. Open a reply here on this forum topic by clicking the "Reply" button.
  9. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  10. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the error output from the upload into the code block.
  11. Move the cursor outside of the code block markup before you add any additional text to your reply.
  12. Click the "Reply" button to publish the post.
Sketch uses 97458 bytes (4%) of program storage space. Maximum is 2097152 bytes.
Global variables use 44488 bytes (16%) of dynamic memory, leaving 225848 bytes for local variables. Maximum is 270336 bytes.
Cannot perform port reset: 1200-bps touch: opening port at 1200bps: Invalid serial port
.....................
Failed uploading: uploading error: exit status 1

this is the output panel that shows me after it uploads

Try this:

  1. Disconnect the USB cable from the Raspberry Pi Pico board.
  2. Press and hold the "BOOTSEL" button on the board.
  3. Connect the USB cable to the Raspberry Pi Pico board.
  4. Release the "BOOTSEL" button.
  5. Attempt to upload a sketch to the board, just as you did before.

Hopefully this time the upload will be successful.

Note that it is expected that the board will not produce a serial port after you connect it to your computer while the "BOOTSEL" button is held down. This is not a problem because Arduino IDE is able to upload to the board while it is in this special boot mode, even without a serial port. The board should produce a serial port after the upload finishes successfully. If it does not produce a serial port after a successful upload, this indicates that there is something in the code of the sketch you uploaded that is interfering (either intentionally or as the result of a bug) with the board's USB capabilities in some way.

1 Like