I'm trying to use CmdMessenger to transfer data over the serial bus between 2 Arduino's, one of which is a Energy Monitor, the other is a ethernet enabled board for uploading data to Pachube. The data will flow just one way, from the Energy Monitor to the Ethernet board, and will take to form of 4,3212,4334,1212,1248; (the leading '4' is a command informing that data is forthcoming. The ',' are data separators, and the ';' is a terminator. The sketch is here http://bit.ly/nSVp0p and the processing section is highlighted.
I can get the sketch to run, but what I want to do is to attach the received values to variables in the Ethernet board, so mainPower has the value 3212, solarPower has the value of 4334, etc. but so have not managed to do so. Any help would be appreciated.
If it helps, the sketch's author has said 'The key to understanding this is to see that the function call cmdMessenger.available() points to the next field in the message. And this will loop around in the while() loop for each successive field. As delimited by your chosen field separator character (and ASCII comma ',' by default).'