For my model train hobby, I devised a method of controlling all turnouts with just 2 buttons. An Arduino keeps track of where a train is, so the buttons may be used to control only the turnout which lies in front of the train. I am still building the hardware so I have not yet test it , though I expect it will work.
The current form of the code, uses a big struct with variables and hardcoded constants which contain information of the entire track layout. If I would change the layout, I would have to alter the struct table and reflash the arduino.
For an other unrelated project, I have built a processing program with which one can draw a schematic layout. This layout can be stored in a .csv file. This program does a lot more than just that but I am going to make a new stripped and modified version of this program which stores all track elements (that is sections, turnouts and detectors) in the EEPROM of the arduino via a USB connection. The arduino is than capable of loading the entire layout from it's EEPROM.
The problem here, is that the arduino itself still needs to be flashed with it's own program for the first time. The processing program will be made as an exported stand alone executable.
Many modeltrain enthusiasts are not very technical and cannot even fill in a few constants in a struct table nor program an arduino.
Therefor, I want to add an "UPLOAD PROGAM" button inside the processing program. This button should run a batch script or something similar which will use arduino CLI and flash the .hex file to an arduino nano or uno.
Ofcourse the mentioned people are by far incapable of installing arduino CLI and initialize it. I would like to download and install arduino CLI on a windows PC, do all initializing and install the cores for the uno/nano's atmega328P by simply double clicking on a single batch file (or whatever other script).
Before I spend my ever scarce free time in trying to figure it al out myself, I wanted to ask these two questions:
- Can this be done in the first place?
- Have people already done this?