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.