Wireless Arduino Programming with Electric Imp

Pages
Contributors: Nate
Favorited Favorite 9

Getting HEX

By default, Arduino outputs the HEX file of your sketch to a rather hard to find, hidden, temporary folder such as C:\Users\Cylon\AppData\Local\Temp\build7734646579940080062.tmp\Blink.cpp.hex. Here's a trick to make change the output folder of Arduino to an easier to find C:\HEXFiles\Blink.cpp.hex.

Arduino Preferences Menu

Open Arduino, and click on File->Preferences. This will show you where the preferences.txt file is stored. If you move your cursor to this area of the window, the directory will turn blue, and if you click on it, you will open the directory that contains the preferences.txt file. You must close Arduino before editing this file. Every time Arduino closes, it will overwrite the preferences file with the current settings. If you edit the preferences file while Arduino is open all your changes will be lost.

Arduino properties file

With Arduino closed, open the preferences.txt. Add a line:

build.path=C:\Arduino-Output\

Or the equivalent path for your OS. Any path without spaces is valid. I enjoy pointing both my Arduino sketch folder and output folder to a dropbox folder so that I can share libraries and HEX files between computers. You will need to avoid spaces in your build.path otherwise you may see this error:

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-ar: unable to rename 'core.a'; reason: File exists

For example: build.path=C:\Arduino HEX Files\ does not work because of the spaces.

Once you have a path in place, save the changes, and close the file. Reopen Arduino, and open a sketch of your choice (use the Examples->Digital->Blink if you have no other sketches). Hit the Verify button to compile the sketch.

HEX File in list

There's the HEX file!

Now, navigate to the build.path folder. You should see a bunch of files including one with a .hex extension. This is the file that needs to be selected and sent via the Electric Imp bootloader.