I have a device that I want to produce in bulk (maybe 50 to start). Each one will run more or less the same code - with a few slightly different variables depending on the user.
At this level I can program them all separately, but I am thinking ahead to potential larger production.
What I would like to be able to do is have users open a custom program in which they are prompted to enter a few variables, connect their device (arduino) to their USB port and then hit save at which point it would upload the slightly modified Arduino sketch the the board.
I want to do this without the user having to see the Arduino IDE or any of the internal code.
I have no idea where to start looking as this is all new to me! Any help greatly appreciated.
Have you considered making the device itself support a "programming mode" user interface, which stores the variables in EEPROM instead of changing the program? If your device already includes suitable human interface components (e.g. rotary encoder and LCD screen), then you could program it using that interface. If not, you could use a standard terminal program on the PC to provide a teletype-like interface that sends and receives serial data to/from the device over USB.
If you really want to change the program, then have your application execute gcc and avrdude, just like the Arduino IDE does.
The way I would do it would be to include a mode where by messages sent down the serial link changed certain variables in the EEPROM. If you are already using this link then the messages could contain a header and check sum to make sure you don't accidentally trigger these routines.
You have a setup application that sends these messages from user input. Then your code's behavior depends on these stored variables. That way you never have to expose the programming function or your code to the user.
You have a setup application that sends these messages from user input. Then your code's behavior depends on these stored variables. That way you never have to expose the programming function or your code to the user.
As an alternative, you could store a config file on an SD card, and include an SD card shield in your project. Read that config file at run time. No need to be connected to a PC at any time, this way.