How to communication between arduino and computer? Answered
I am working on Fleet management and this with my project
There are three possible states for the device which we need to implement (Off, Running, Configuration, Factory Settings)
There should be a button to change the device status (only one button please).
If the device is already off, pressing this button should bring the device in running mode.
If the device is on, pressing this button for 5 seconds should bring the device in configuration mode
If the device is in configuration mode, pressing the button for 5 seconds should restart the device, and pressing the button 3 times should set the variables to default values.
If the device is on, pressing the button for 10 seconds turn of the device
When the device is in configuration mode, we should be able to plug the device with a computer using USB. The device should start sending it's internal APN code with a specific sequence e.g. TR<APN>RT as soon as it sends this code to the computer, it should wait for response from the computer.
The computer can sends back the code TR<APN>RT or no response.
When the device receives TR<APN>RT, it should match the IMMI it sent and the IMMI it received. If both matched, then it should wait for settings:
The computer will send data as TR<varname:value>RT where varname is e.g. APN, USERNAME, PASSWORD, URL, POLL_INTERVAL etc. the value after first : is the the value of the variable.
The device should save these values to SD or it's internal memory immediately.
Now press the button for 5 seconds, the device should restart and straight away enter into running mode. Now the device should connect to server using and sends GPS location and speed every interval set by the POLL_INTERVAL variable.
Let's achieve this first, I'll add more functionality once we're done with this.