Wednesday, 12 August 2015

arduino - Creating a sketch (.HEX) file from a .PDE file


I have been using the Ardunio IDE to edit code for an Arduino sketch.


I was having trouble uploading to the board, so I bought a pocket progammer in response to this question: What possible ways can I upload sketches to arduino mega chips?


Now, using this programmer I can upload .hex files via the command line.


Now I want to create a .HEX file from my existing .PDE files.


The problem is:



  • The graphical IDE has a "Upload Sketch" button (which compiles and attempts to upload in one go), but there doesn't seem to be a "Create Sketch" button.


  • avr-gcc can create a sketch (I believe) but doesn't recognise .PDE files.


How can I go about creating this Sketch?



Answer



When the Arduino IDE compiles your sketch it creates a .HEX file in a temp directory, which is then uses to upload to your board.


The .HEX file will have the same name as your sketch (without the .pde extension), followed by .cpp.hex


I just tried a build and the .HEX file was created in a directory called build2849146248544311107.tmp inside my Temp directory (C:\Users\USERNAME\AppData\Local\Temp\ on Windows 7). Presumably the numbers in the build2849146248544311107.tmp directory name will chanage.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...