hi all
i'm working on a multi-arduino project: it's a server-client system that can "emulate" a multi core processor.
it's basically a arduino mega, that contains all the variables, and 2,3,4,5,6... other arduino boards that ask all the variables to the server.
this should allow the user to do many connected things (for example controlling a complex robot, with lots of motors, sensors...).
there's one only problem, after the server receives the name of the variable to read and resend, i don't know how to read the variable on the server.
for example, the string "out" (sent to the server) contains "SensorValue", that is the name of the variable stored on the server,
the server receives this variable and store "SensorValue" on another variable string called "reading".
now, how can i read the "SensorValue" variable?
thanks for help and sorry for my bad english
I think you need to devise a "protocol" for your communication system using either abbreviated identifiers for data elements or using the position in the string of data to identify which item is which.
It would be very inefficient (and no advantage to the compiler) to use the "human" names of the variables which should be chosen to make the code easy for you to understand - especially when you haven't seen it for 12 months.
How many different pieces of data will be sent?
...R
You could maybe look at the pre processor's stringify operator #.
With some clever macros, you could achieve what you're aiming for.
thanks for answers, i think that the best options here, is a series of if statements, i'm going to make a library for this, so it won't be too difficult to use