I've tried searching for this but have not been able to find any relevant information.
How do you create your own windows/mac application to be able to program a microcontroller/arduino? For example, I have this toy idea that needs to connect to a customer's wifi connection. I want to be able to create an application so that when the end user plugs the toy into their computer via usb they can use the application to program the arduino with the ssid and wep/wpa passphrase.
Is there an example I can find online where somebody has done this? How does the Arduino software talk to the bootloader and how would I be able to replicate that in my own application?
I am not sure the responses so far address what the OP really wants to achieve.
Perhaps the OP may want to better explain what he actually wants to achieve.
In order to connect a toy ( what size are we talking about ? ) to a WiFi network you wound not need to "program" the SSID and WPA key into the Arduino. What you have to do is to configure the Arduino side of the WiFi connection with these parameters. That does not really per se require you to connect the device to a computer Via USB, and compile/ upload the hex co to the Arduino, even though that could probably be one way, alas thats rather complicated!
A more common way would assume that the toy comes with a builtin WiFi "device" that, similar to many pocket WiFi routers, comes configured as its own Access Point (AP). You'd power the toy up and then connect to the Toy-WiFi device via Internet browser. The Toy-WiFi device then would serve a web page to allow configuring the WiFi connection to connect to the Users Home network and ultimately to the Users computer.
The next question is, once you have established a WiFi connection, what do you want to do with it ?
That may determine what protocol is best for what you want to do, TCP, UDP ?
Do you also want to access it from mobile devices ?
Headroom, thanks for your advice. I think what you said more accurately answers my question. Let me try explaining again just to clarify.
Essentially I want to create multiple devices that can be controlled over a home wifi network. The controls are very simple, just a start/stop command. The problem is that I want the setup for these devices to be as simple as possible so that people that are not tech savvy can still use these devices.
My idea thus far was to get an arduino with a wifi shield as the device. Then create a desktop application that the user would use to program the ssid and wpa key. This application is also what the user will utilize to start/stop the device(s) once set up.
I never thought about making the device an AP, that is a good idea! I wonder if that will change the cost of things. But I still have the question of how would the webpage that the device serves then be used to connect to the home network?
Here's what I think he wants to do - He sells the "toy" to someone and they need to load the wireless access info in to the "toy".
What I would suggest is that you create an application that runs on the PC (I would use Visual Basic 6 because I have it and am used to working with it for stuff like this)
You hook up the USB to the computer (and load the device driver...) with the application you create and when the "toy" and the PC Appliction are talking the user could then enter the access info and then the application would transfer that to the Arduino program which could then transfer that information to the EEPROM. When restarted the Arduino would check for a serial connection and if not found it wold read the network info from the EEPROM and continue on its way.
WHa the Arduino program would need to do is send some aequence of charaters, wait for a responce from the PC application. If the PC responds then the PC application is able to send the network info. If the process times out then the aArduino would go to "toy" mode.
I am considering a "persistence of vision" project with some kids I do a science day with sometimes. It would be based on an Ardu' compatible '328. They need to be able to take it home and enter new text using their home PCs.
My plan was just to use a Serial monitor like that which comes with the Arduino IDE.
All you need is to plug your Arduino (I will use a cheap USB<->TTL adaptor) into your PC and run a serial monitor. During the "setup()" part of your code, you then prompt for a serial input and wait a few seconds for response. If you get a response, you then prompt for new data - in my case new "PoV" text - in yours you could prompt for Wifi network details which you enter over serial. Once the data is entered over serial, you just confirm, write it to EEPROM and carry on with your sketch.
Edit - a simple program could be written in Processing, if you wanted to remove the command-line nature of that method - you enter the data into your Processing application and reset your Arduino. The above serial communication then takes place automagically. You could program lots of Ardu's with the same data that way without needing to re-key it.