Busca en nuestro Blog. Encontrarás múltiples aplicaciones, soluciones, ejemplos de código. Navega utilizando la nube de etiquetas o busca utilizando criterios específicos
How to upload a sketch to a M-Duino/Ardbox using the shell/Command Line - Windows
IntroductionIn this post it will be seen how to upload a sketch using the command line instead of using the Arduino IDE. This is an introduction for a newer post in which we will show how to upload remotely a sketch using the command line. Without further delay we will see how this process can be achieved.
First of all we need to know that for uploading a sketch using the command line it is necessary to use the program avrdude. This program is part of the Arduino IDE tools as it is the tool that uses Arduino IDE to upload the sketch. This avrdude is found inside the Arduino directory.
For run an executable in the terminal prompt it is necessary to be in that directory, or call all the path to tell to the terminal that the program you want to execute is found in that directory. A better solution in order to run a program without being in that directory is to add to the variable path, the path where the program is. The path is actually a viariable, this variable contains all the paths that the system specifies. So if we want to execute avrdude being in another directory it is needed to have the avrdude.exe path on the variable path. This way it will automatically search for the program.
So the first step will be to add the avrdude to the variable path. To get into the Variable Path you need to search the word “variable” on the start button. This will get you directly to the correct window, jumping some little steps to get into there.
The second thing is to select the Environment variables, where it actually is the variable path.
The third step is to edit the Path variable, adding the path of the Avrdude.
In my case avrdude is in: C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
The avrdude in my computer is found inside the bin directory.
Once it is added the last thing to do to set the path is to reboot the computer in order to save the changes. Maybe it is already added to the path, but in our case we have needed to do that, so for ensure the process better do a reboot.
Once it is in the path we are ready to send the sketch to the PLC. Avrdude works with files with the extensions of .hex. So a file with the extension .ino(typical sketch) can’t be sent directly to the PLC. So we actually need to have the .hex file. This file is created by the time we compile using the Arduino IDE software. In the future we will post how to compile an sketch .ino into a .hex to use the terminal for all the process. By now we will focus on just the avrdude. In order to search the .hex take a look on this post where we explain how to take the binary file from an .hex file: