Kind of bricking an Arduino Duemilanove by exhausting its memory

Following from my latest hardware explorations, I initially wanted to find how to reset my Arduino Duemilanove with ATMega168 the board with JavaScript and node.js, using serialport (instead of Python).

But ended up trying to make it work with Johnny Five.

First I tried uploading the simple blinking LED example, and got this error:


1452686176011 Device(s) /dev/cu.usbserial-A60061c2
1452686176021 Connected /dev/cu.usbserial-A60061c2
1452686186027 Device or Firmware Error A timeout occurred while connecting to the Board.

Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting

So I tried flashing the Firmata firmware with "File > Examples > Firmata > StandardFirmata" but I got this other error:


Arduino: 1.6.7 (Mac OS X), Board: "Arduino Duemilanove or Diecimila, ATmega168"

Sketch uses 12,734 bytes (88%) of program storage space. Maximum is 14,336 bytes.
Global variables use 1,036 bytes (101%) of dynamic memory, leaving -12 bytes for local variables. Maximum is 1,024 bytes.
processing.app.debug.RunnerException: Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
    at cc.arduino.Compiler.size(Compiler.java:319)
    at cc.arduino.Compiler.build(Compiler.java:156)
    at processing.app.Sketch.build(Sketch.java:1108)
    at processing.app.Sketch.exportApplet(Sketch.java:1138)
    at processing.app.Sketch.exportApplet(Sketch.java:1124)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2430)
    at java.lang.Thread.run(Thread.java:745)
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Apparently the ATMega168 doesn't have enough space to flash this firmware, i.e. it would need 12 more bytes to fit.

I'm stubborn and also curious to experiment, so I tried flashing OldStandardFirmata (although I had to manually select the serial port with Tools - Port - /dev/cu.usbserial-A60061c2) and then tried to run the Johnny Five example again, but I kept getting


1452687301754 Device or Firmware Error A timeout occurred while connecting to the Board.

Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting

Then I updated the Arduino IDE drivers and tried to upload the newer Firmata firmware that came with the update, which in theory had enough space... and then the Arduino would just show a very fast blinking L led :-(

https://vine.co/v/iMUgUXFwIiV

And apparently this is what they meant with the Arduino entering an "unstable" state if you try to upload something that doesn't leave any free memory... or so this post says, as well as a trick to reset the Arduino without it constantly resetting itself.

I tried that multiple times, to no avail! I thought that my Arduino was bricked FOREVER... but someone told me there's a way to recover, using another Arduino, and will help me restore my Duemilanove back to life in the next NodeBots London event.

Looking forward to it! :D