Copy code from one arduino to another

I was given 10 arduinos with the same code already on them and I would like to use some to teach kids some basic circuitry. I was just wondering if there is a way to transfer the code from one of the unchanged arduino back to the others. I am pretty new to this so detailed instructions would be appreciated. Thank you!

Do the Arduino boards have a normal bootloader, and the sketch uploaded in a normal way ? Let's assume they do.
You can download the binary code from an Arduino with avrdude.

Try and find the site that has the code (or the seller if its ebay), and use that.

The code isn't online, and the guy I got the arduinos from lost the source code. How would I download the binary? And how would I then upload it to another? Sorry, I'm pretty new at this and can't find an answer online that I can understand.

You need a programmer and the ICSP header.
It is also possible to use another Arduino as programmer. That is called "Arduino as ISP".,6150.0.html

what task do the arduino's do, you might just want to build a new copy of the code so that you have the source, or make it a challenge and have one of the kids write you new source code.


The current code detects the temperature and outputs it (in Fahrenheit and Celsius) on 3 seven-segment LCD displays. I would rewrite the code but I have never used 7 segment displays and have no idea how to use one. I skimmed through the links provided and a lot of the information seems to be way over my head. If anyone could give a more basic instruction it would be extremely appreciated!

Seven segment LCD or LED displays?

I really don't know whether its led or lcd.

Take a couple pictures of one setup and work and maybe a video

LED 7 segment:

LCD 7 segment:

I guess it's LED then. I'll include a picture.

Great Scott, I can see the fabric of space-time itself! Scale back those pictures. I think I can count microbes on your protoboard.


Haha sorry about that! Here's a video too.

Shouldn't be as big this way!

I think that you'd need the original 'source code' .pde or .ino on a PC with the (free) Arduino IDE installed.
I can mainly think of bad reasons why users might want to rip compiled binary out of finished devices, so there is no reason why an open source project would back that. Such binary would not work on different hardware and an automated decompiler would have to autogenerate uneducative names for most of the variables.

So, my guess-answer is "no"; expect to compile and upload to each from your local copy of your source code.

So then if I don't have the source code anymore, my only option is to rewrite it?

I was given 10 arduinos with the same code ....... wondering if there is a way to transfer the code from one of the unchanged arduino back to the others.

Might I ask did you change the code on some of them, and now you would like to transfer code from one of the originals back to the changed ones? Just to make sure I understand your question.

I will admit that I am quite possibly less informed with arduino than yourself, but just yesterday I did just what I believe it is you are asking.

Now, how I did it will require quite an exercise in memory recall on my part! My success was for the most part just a matter of trial and error as most of these things are not at all intuitive to me.

Essentially what I was able to do(did this twice, two differently programmed atmegas) was:

  1. Create and retrieve a .hex file by reading what was flashed onto the atmega328p on my Uno.
  2. Replace the atmega328p chip on my Uno with another atmega328p, or connect an entirely different Uno. (I tried it both ways)
  3. Flash the created .hex file to the new atmega328p, creating essentially a "cloned" new arduino.

..The basic overview(seems to have) went something like this:

  1. download and install //I have used this for another application before and it has worked for me with no surprises. I believe it to be safe to install.

  2. While the Arduino/atmega328p that I want to "clone" is connected:
    Using the command prompt on my Windows7/64 pc (cmd.exe in windows search) to directly send commands to avrdude, all of that info I found here: AVR Tutorial - AVRDUDE
    I had to change directory (cd C:\whatever_directory_you_want_to_change_to....but in this case cd C:\Program Files (x86)\Xloader ) in the command prompt from C:\Users\Billcat to C:\Program Files (x86)\Xloader , for any of this to work. Then from the above linked site I directly commanded avrdude:
    hint....I manipulated the -U flash:r:name_the_file_what_I_want.hex:i to be exact, this is what I entered: avrdude -c stk500v1 -p m328p -P com4 -U flash:r:name_the_file_what_I_want.hex:i ....and watched avrdude appear to read the file and hopefully write it to someplace my case that someplace is C:\Users\Billcat\AppData(normally a hidden folder)\Local\VirtualStore\Program Files (x86)\Xloader which is right where it needs to be.

3. Use the windows search to find where avrdude placed the just read/created .hex file. Mine was found in the C:\Users\Billcat\AppData(normally a hidden folder)\Local\VirtualStore\Program Files (x86)\Xloader folder, to my surprise as name_the_file_what_I_want.hex :smiley: Upon attempting this process again, I found that the hex file is created in the proper folder that it needs to be so no need to search!

  1. Replace the connected Arduino/atmega328p with the one that you want to clone to. Go back to cmd.exe, and issue an avrdude command something like : C:\Program Files (x86)\Xloader\avrdude -c stk500v1 -p m328p -P com3 -U flash:w:name_the_file_what_I_want.hex I had to change the port number(com3) to the one I found assigned to this Arduino when I connected it (from device manager)

and seems to have worked, the new Arduino appears to be an exact copy of the "cloned" Arduino

Disclaimer: This is what indeed did work for me, your mileage may vary! I make no guarantees that following my instructions will work for you, that it won't destroy your arduino, that it won't blow up your pc, that it won't catch your house on fire, etc. I am an absolute novice with programmable MCU's. :wink:

good luck!

So then if I don't have the source code anymore, my only option is to rewrite it?

if all you are doing is to read a temperature and then write to the LED, then you are MUCH better off starting from scratch.

both the temperature and output are available.

also, once you have the source code, you can change it as you like.

FWIW, today I attempted the procedure I described in reply#16 and it worked once again for me. However, I have edited my previous reply to correct some mistakes that I made in that reply. :blush:


Just bite the bullet and buy some replacement LCD displays that are easier to wire up and program.

What the project does is trivial and you could rewrite the code in a few hours, at the most.