[SOLVED] Arduino uno stuck on "uploading"

it keeps saying "uploading"

can i get my code checked?

int time = 30;

void setup(){
//start serial connection
Serial.begin(9600);
//configure pin2 as an input and enable the internal pull-up resistor
pinMode(0, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(7, OUTPUT);

}

void loop(){
//read the pushbutton value into a variable
int switchVal = digitalRead(2);
int sensorVal = digitalRead(0);
//print out the value of the pushbutton
Serial.println("Sensor" + sensorVal);
Serial.println("Switch" + switchVal);

// Keep in mind the pullup means the pushbutton's
// logic is inverted. It goes HIGH when it's open,
// and LOW when it's pressed. Turn on pin 13 when the
// button's pressed, and off when it's not:
if (sensorVal == HIGH && switchVal == LOW) {
tone(7, 3000, time4);
delay(time
4);
tone(7, 2800, time4);
delay(time
4);
}
else {

}
}

TheTurtleKing:
it keeps saying "uploading"

can i get my code checked?

int time = 30;

void setup(){
//start serial connection
Serial.begin(9600);
//configure pin2 as an input and enable the internal pull-up resistor
pinMode(0, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(7, OUTPUT);

}

void loop(){
//read the pushbutton value into a variable
int switchVal = digitalRead(2);
int sensorVal = digitalRead(0);
//print out the value of the pushbutton
Serial.println("Sensor" + sensorVal);
Serial.println("Switch" + switchVal);

// Keep in mind the pullup means the pushbutton's
// logic is inverted. It goes HIGH when it's open,
// and LOW when it's pressed. Turn on pin 13 when the
// button's pressed, and off when it's not:
if (sensorVal == HIGH && switchVal == LOW) {
tone(7, 3000, time4);
delay(time
4);
tone(7, 2800, time4);
delay(time
4);
}
else {

}
}

turns out it even gets stuck loading on the "bare minimum" example. helppp?

TheTurtleKing:
.

tried doing that "DFU" thing, uploaded a new hex (i think)
still wont run. am i reseting the board correctly?

attempted a loop back test,
it just spit out data from my previous upload, and kept spitting out data

what now?

Why are you using pin 0?
Pins 0 and 1 are used to upload by the USB cable.
Don't use pins 0 and 1.

steinie44:
Why are you using pin 0?
Pins 0 and 1 are used to upload by the USB cable.
Don't use pins 0 and 1.

Thanks, noted.
problem is still not fixed, however.

(deleted)

[solved]
not exactly sure how i solved it.
from what i remember doing, i rebooted my computer and uploading the bare-minimum example into the computer.

bare-minimum example (found on arduino's example guides)

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly: 
  
}

I have experienced this recently, the problem came from board setting was set to another board for unknown reason. After choosing a correct board, it could be uploaded.

Cheers,
Rock Li

I had this happen to me on an UNO R3. I solved the issue by disabling Bluetooth on my laptop. It was causing a conflict on COM5.

I had ruled out the board, cable, and IDE. Finally noticed in Device Manager that COM5 had entries (one being the Arduino and the other being Bluetooth). This was on Windows 10 Pro.

Hope that helps someone else that might have this issue in the future.

4 Likes