'An error occurred while uploading the sketch' Arduino

Multi tool use
Multi tool use


'An error occurred while uploading the sketch' Arduino



I am learning to receive data from the UART pins of the Arduino. I am using a SPEC Gas Sensor for the same. Here is the simplest code I could write.


void setup() {
Serial.begin(9600);
}

void loop() {
if(Serial.available()>0) {
Serial.print(Serial.available());
}
}



The code verifies but when I try to burn this code in the Arduino Uno, I get the following error after it says that the code uses 5% of the storage space.


Sketch uses 1744 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 184 bytes (8%) of dynamic memory, leaving 1864 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x1e
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x66
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x7e
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x06
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x86
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xf8
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x06
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x7e
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x86
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x9e
An error occurred while uploading the sketch



I checked online for a solution but they provide basic answers like restarting everything. It doesn't work.



Please help.




2 Answers
2



When uploading a sketch, you must disconnect the serial I/O pins from any devices before an upload succeeds.



The Uno shares the two hardware serial pins with the USB that's used to perform sketch upload, so nothing else can be connected to the serial pins (0 and 1).



If I recall correctly, you only need to disconnect the Rx pin, but that's from memory, so disconnect both and it'll almost certainly work.



When uploading a sketch check whether arduino board was set into correct configuration.such as selecting the uno board ,serial port ,even when you constructing a model of bidirectional it work when u assign the SAM board.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

bWcGPzakjUFb26OoyAmwUOneAhRDt3T,XqbdNPsbI g6jEw82nPsY
Ja0i3DyOp4zkmRPZ ji czTs,ZMe

Popular posts from this blog

Rothschild family

Cinema of Italy