I am new to the Arduino world, even if i have a long experience (30 years already :o) as professional developper.
I understand that the bootloader calls once the setup() routine, then it calls the loop() routine forever.
I wonder if it can call some clean-up routine when the PC contacts it to upload a new program ? Or would it call the destructor method of global objects ? Or does it just stop abruptly the running program ?
I would like to stop cleanly before uploading new sketch: clean-up lcd and stop currently playing midi notes for example.
Thanx for your help.