Reading variables from serial


hi all
i'm working on multi-arduino project: it's server-client system can "emulate" multi core processor.
it's arduino mega, contains variables, , 2,3,4,5,6... other arduino boards ask variables server.
this should allow user many connected things (for example controlling complex robot, lots of motors, sensors...).
there's 1 problem, after server receives name of variable read , resend, don't know how read variable on server.
for example, string "out" (sent server) contains "sensorvalue", name of variable stored on server,
the server receives variable , store "sensorvalue" on variable string  called "reading".
now, how can read "sensorvalue" variable?
thanks , sorry bad english

the variable names don't exist anymore once code compiles.  if want you're going have set series of if tests 1 each variable name.  if variables of same type keep names in 1 array , pointers variables in array.  when recieve string search in name array , access value value array same index.  guess third option define template class has members name , value , member funtions match names , stringify values go out on serial connection.

but chain of if else if statements going quickest easiest thing.


Arduino Forum > Using Arduino > Project Guidance > Reading variables from serial


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support