arduino modify one location on the card or modify a variable while the program is still kept running

sydneyguy
sydneyguy used Ask the Experts™
on
ardunio on board memory manipulation have a arduino mega now what is the best way to do the following, i want to have the program running and then update the array on board the arduino with out reloading the program, so lest say i have an array with 10 numbers and depending on the feed back from the card i am going to change location #4 of the in the 10 mem locations that i have set up how is the best way to do this please from the code running on the pc , would i access the arduino then the mem location and go from there, any ideas in this correct direction would be helpful
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Business Systems Analyst / Software Developer
Top Expert 2015
Commented:
From what I can gather/assume from your question, are you saying that you want the Arduino to stay connected to the PC and for the PC to be able to communicate while the Arduino is still running and to be able to send data to it to modify the way the Arduino is running, or modify the data in the Arduino memory?

If so, this is not necessarily the easiest thing to do, unfortunately!!!  What you need to do is to get the PC to talk to the Arduino over the "serial port" connection (which happens via the USB connection). Then you will need to create the protocol for what gets sent over the serial port in order to update the memory locations. Here is one of the problems, because there are a huge number of ways you could design this: anywhere from sending plain binary data all the way up to complex things like sending XML or maybe JSON content that describes what you want to do (and everything in between). Once you have done that, you then need to code that into the Arduino, to receive this data, parse it and perform the memory update. Also, you mention "code on the PC" so if you don't want to be physically typing these commands into some serial port monitor program on the PC, you will then need create the code for the PC application to send the right data using the protocol you come up with down the serial port.

Not saying any of the above is impossible, just that there is a lot to it.

If you are still keen, I would start by learning about serial communications, and in particular with the Arduino. Look up some "arduino serial tutorials" on Google and once you have that working, look particularly at "arduino serial input tutorials"

Good luck!

(Note: just a comment about your questions... they are fairly hard to read and understand with the lack of sentence structure. If you can try to state the questions a little clearer it may help in the future.)

Author

Commented:
thanks for that yes that is exactly what i will be doing,watch this space for more questions,
 have already started reading "programing C for arduino " any other well written books worth going through.
 and i may be loading up eclipse i have been reading abut that and have used it in the past. might be a way to go more reading required.
as for getting my sentence structure more readable, have just re read it, your right, gee i must have been tired when i posted it.
thanks for the heads up.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial