I can't upload sketches to my Arduino Micro anymore. After i uploaded a self-opening sketch that will execute when plugged in, i decided to delete the sketch because i wanted to edit the script. I deleted it but then i couldn't upload a new sketch anymore. I unplugged it and plugged it back in. The blue LED was lid but the orange one was only flashing for less than a second. The green one doesn't even turn on anymore.
I tried to reset it with the button, waited 8 seconds but it disconected from my pc while it was still on. In the first 8 seconds i cannot upload. This means it is impossible to upload because after 8 seconds, it disconnects automaticly.
C:\Users\PCNAME\AppData\Local\Temp\ccZ0uwgH.ltrans0.ltrans.o: In function `main':
C:\Users\PCNAME\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/main.cpp:43: undefined reference to `setup'
C:\Users\PCNAME\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/main.cpp:46: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
I tried to find solutions but found none. Please help me.
What did you delete and what do you want to edit - sketch/script ?? You cannot delete the sketch in the micro. You only can overwrite it with another ( correctly compiled! ) sketch.
Please post the sketch you want to upload. Seems you want to upload a sketch without a setup() and loop() function.
Thanks for helping me but i uploaded the code and now my green light works again how it should be. But i still get this output:
Sketch uses 3958 bytes (13%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.
Programmer supports the following devices:
Device code: 0x44
Any idea what is going on?
(I'm a newbie btw. Sorry if i don't give you the right info.)
Oh..whoops . But when i run the script, windows makes a disconnect sound. After a couple seconds it says it connected again. Is it supposed to disconnect when running?
Yes. The Arduino micro runs in one of two modes. In the first mode it executes the sketch, in the second one it's in bootloader mode. When you upload, it switches from execution mode to bootloader mode so you can upload. After that it switches back to execution mode.
I see, but it the script even runs when plugged in. Idk why.
const int dummy = 0;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
}
By default it's in execution mode. If you enable verbose output during upload, you can see what happens once the IDE reports the memory usage.
It attempts to reset the board; any code that is uploaded has a very small piece of code that detects the baudrate change and results in a reset of the board. After the board is reset, a small part of code (technically part of the bootloader) determines the cause of the reset.
When it knows the cause of the reset, it will either wait for the upload or hand over to your code.