Deadly code?? 3 arduinos faulting


A sketch I wrote ran successfully on an Arduino Uno for week.
The arduino died (probably due to a faulty AC-DC converter), so I tried uploading the sketch to an Arduino Nano I have, and then to two arduino Yuns.

None of my arduinos work now!
The message I get from both Yuns -
Nano -,XC43X4C

Here is the sketch I uploaded - Dropbox - faulty_sketch.ino - Simplify your life

The sketch had the Uno collect readings from various sensors and transmit them to a server via a GSM SIM900 shield. It worked well.

Things to know:

  • All arduinos worked properly before I uploaded the sketch
  • Yes, I’m sure I chose the correct board/port in the IDE
  • The built-in led (13) blinks on the boards, so I believe the bootloader is okay
  • The arduinos are not wired to anything when I try to upload the Blink sketch (or an empty sketch). That includes the TX/RX ports.

I roamed the web for days; I’m posting here as a last resort. Any advice will be most appreciated!

Did you try remote (network) upload with the yun? It will reflash the 32u4 as you would do with an external programmer. At least, you can recover the yuns by uploading a blink

Federico Fissore Thank you! That worked :)) My Yun's have now returned to life, and I can upload sketches normally via USB

What's the solution for the Nano? And why do you think this happened? Is there an error in my sketch?

With the nano you need to use an external programmer and reflash the bootloader

If you're keeping the serial port busy with your program, you will not be able to upload another program. Try putting a 2 to 5 sec delay before using serial, then when you press upload you hit reset at just the right time, and the arduino will respond.

If your sketch is flooding the USB with output, try this:

Hold down the Reset button.
Unplug the USB cable (this flushes the buffers).
Re-plug the USB cable.
Start an upload of the Blink sketch.
When the RX light blinks, release the Reset button.