How to Get Hex File From Arduino

  • Hello friends, we hope you are all well and have fun with your life. In today's post, I will share how to get Hex File Arduino. Its quite easy job and I have repeatedly explained in my post but I get a lot of messages about which is why I thought to write a separate post for her. First, provides a small introduction about it. If you worked on PIC Microcontrollers Atmel or etc then you saw that you still get hex file their compilers and you burn the hex file into the microcontroller using their respective programmer or burner. But this is not the case with Arduino. In Arduino, simply plug it in to your computer and hit upload button and the code automatically gets downloaded to the Arduino. It does not create a hex file. You should also take a look at Arduino library for Proteus in which you can download this hex file.

  • So, now the question arises that why we need the hex file in the first place, when you can download the code without it? The answer to that is, there are many cases where the hex file is required. For example, instead of using the Arduino board you just want to use the ATmega microcontroller or ATtiny then the best way is to write the code in Arduino and then get the hex file and download it to your microcontroller, which makes the task easy enough. Another example is the Proteus simulation, when you want to simulate your Arduino board into the Proteus software then you need to get the hex file so that you can download into your Arduino baord. Another case is freelancing, when working on a project freelancer, then there are many cases where you do not want to send your code to the client, instead you want to send the hex file for him so he can test and verify the code, in this case, it was also necessary. So let's start with how to get the hex file of Arduino.
  • First of all, open your Arduino software and write your code and test it.
  • Once you are confirmed that your code is ready and you want to generate the hex file, then click on File option in the above menu and then Preferences as shown in below figure:

  • In the above figure, I have used the simple blink example and I am gonna generate its hex file.
  • Now when you click on the Preferences, a new window will pop up.
  • In this new window, tick the compilation option as shown in below figure:

  • After ticking it, now click on the OK button and this dialog box will close.
Note:
  • By ticking this option you are allowing the Arduino software to show verbose outputs in the output panel present at the end of Arduino software, which has black background.
  • So, you can also tick the upload option but the you need to upload the code to get these output commands.
  • Now hit the compile button as we tick the compilation option, so it will compile the code and will give you all the commands as shown below:

  • Now you can see clearly in the above figure that there are many commands in the black portion, these are the verbose outputs which Arduino is giving us.
  • The last line of these verbose outputs, which I have also highlighted is the link to your hex file, which in our case is:
C:UserszainAppDataLocalTempbuild7243111610766241365.tmp/Blink.cpp.hex 
  • Now, remove the name of the hex file from this link and it will become: C:UserszainAppDataLocalTempbuild7243111610766241365.tmp
  • Paste this link in the computer address bar and this folder will open up.
  • In that folder search for your respective file and you easily get the hex file of your code.
Note:
  • Actually, while uploading the code to Arduino boards, Arduino software creates the hex file of the code in the temporary folder and once the code is uploaded then it deletes that hex file, that’s the reson we dont get the hex file, but by clicking the option you can easily get the hex file and then can use it for any purpose.
That’s all for today, and I think it was quite easy tutorial but still if you having questions then ask in comments and I will resolve them. till next tutroial, take care!!
Previous
Next Post »