Show Posts
|
|
Pages: [1]
|
|
1
|
Using Arduino / Programming Questions / how do I parse Serial Data only when preceded by....
|
on: November 29, 2012, 05:51:43 am
|
|
I would like to analyze incoming serial data looking for...
If "A" comes in then look at the next 8 numbers
do something to first number, do something to second number, etc.
If "B" comes in then look at the next 8 numbers
do something to first number, do something to second number, etc. When there is a line break exit this function and start looking for A's and B's again.
I know this isn't that complex, but I am having a lot of trouble figuring it out. My background is in max-msp. Any help would be appreciated. ChristopherO
|
|
|
|
|
2
|
Using Arduino / Programming Questions / simplest way to "route" messages
|
on: March 02, 2011, 02:39:54 pm
|
|
I am sending values over serial from max. I have single chars being handled with if/else statements in arduino. What I want is a simple messaging/labeling system. I am aware of the many libraries that do this and much much more for me. But I just want to know the code of how to do it without an external library, as I am still trying to learn the basics here. Thanks for the help.
from max these are some example messages a222 z235 s124
I would like to: "if the first char is a then set the value[a] to 222" if the first char is z then set the value of [z] to 235
etc.
How would I go about achieving this. To let you know where I am coming from attached is the static version I have running:
if (Serial.available() > 0){ // Check serial buffer for characters char ch = Serial.read(); //Serial.println ('ch');
if (ch == 'a') { // If an 'r' is received then run the motor dc1.setSpeed (250); // This is where I would like the value 250 instead to come from a longer input message ie. a250 dc1.run(FORWARD); // turn it on going forward // Serial.println ("Moter one triggered!"); } else if (ch == 'z') { // If an 's' is received then stop the motor dc1.setSpeed (0); dc1.run(RELEASE); // turn it off
|
|
|
|
|
3
|
Forum 2005-2010 (read only) / News / Re: Messenger library name parsing
|
on: January 21, 2010, 05:57:15 pm
|
|
Not very experienced with Java. I am a maxmsp whiz. This library seems like what I want (firmata is too bloated), but maybe it can't do this?
I just want to route messages, like in the example but parse numbers that follow the message name. ie send a value over max-messanger like this:
dimmer1 $1 dimmer2 $1
Sorry if this is obvious.
|
|
|
|
|