A GUI application that shows up the connected Arduino boards and allows the user to select one. It was developed to be used together with make-arduino.bat file (from Céu-Maker) as follows:
- the
make-arduino.bat
is executed; make-arduino.bat
executes theSelectDevice.exe
;- in the oppened window, the user can:
- select a board: in this case the
SelectDevice.exe
returns to themake-arduino.bat
a string containing the board, port, and if necessary, the cpu, separated by empty spaces; - close the window: in this case the
SelectDevice.exe
returns to themake-arduino.bat
an empty string.
- select a board: in this case the
the
make-arduino.bat
check if the received string is empty or not. If it is, themake-arduino.bat
finalize. If the string is not empty, it strips the string and pass the information (board, port and cpu) to Arduino Makefile.
The Arduino IDE uses the file arduino-1.8.3\hardware\arduino\avr\boards.txt to identify ports and boards. With a VID/PID combination we can identify the USB device that is plugged and then search in this file for more information, such as the name of the board.
This app was developed using Visual Studio Community 2015 and only supports devices from package "arduino" and arch "avr".
To create a new release version, make sure to move the exe generated by the Visual Studio from SelectDevices/bin/Release/ to ceu-maker/ceu-maker/run
In the SelectDevice/Form1.cs, we can find blocks of code using #if DEBUG
:
#if DEBUG
string text = System.IO.File.ReadAllText(@"absolute-path-to\arduino-1.8.3\hardware\arduino\avr\boards.txt");
#else
string text = System.IO.File.ReadAllText(@"..\arduino-1.8.3\hardware\arduino\avr\boards.txt");
#endif
The above code was included to facilitate the location of boards.txt file in develop stage. If you're compiling a debug version o SelectDevice, you can use the absolute path of boards.txt
changing the string in the second line. For release, use a relative path.
- How does Arduino IDE 'Get Board Info'?
https://arduino.stackexchange.com/questions/39137/how-does-arduino-ide-get-board-info - How to obtain an USB VID/PID for your project:
https://www.voti.nl/docs/usb-pid.html - Notes about executing Arduino IDE via command line: https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
- Explanation about package, arch and board in command line --board:
https://forum.arduino.cc/index.php?topic=366484.0 - Arduino IDE 1.5 3rd party Hardware specification
https://github.com/arduino/arduino/wiki/arduino-ide-1.5-3rd-party-hardware-specification - Visual Studio 2015: How to: Set Debug and Release Configurations
https://msdn.microsoft.com/en-us/library/wx0123s5.aspx