i’m having some problems with parsing rs232 string from arduino board.
with one pot data from arduino looks like this:
value has range from 0 to 1023
with one pot there is no problem becouse i take the string to tokenizer (as separator i use letter a) and then transform it to value.
i was using patch from MrBenefit: http://vvvv.org/tiki-index.php?page=arduino03
but when i use two pots i cant parse them with tokenizer.
data from arduino looks like this:
first and second value has range from 0 to 1023. first value is from pot 1 and second is from pot 2. i vould like to split this string in two values. i’ve try it with tokenizer and i cant make it work.
ive read the helpfiles for the automata a few times but i havent really understand it. are there examples off practical uses of automata in a vvvv-patches? that would be a great help, because the help docs are quite theoretical and not so easy to understand if you have no programming experience like me.
the Tokenizer (string) node would be the one to use. you can spread the separator pin to make the tokenizer react to multiple separators.
see the attached patch fragment. its completely untested, but should give you an idea.
the reason for the tokenizer is to synchronize the arduino output to vvvv frames - in the simplest case that you will receive one complete data message in one frame (when the tokenizer is an enqueue mode). you will not want to have parts of the data packet (like the pot number from the current reading, but the value from the last reading)
as you can change your arduino code really easily
id sugest sending a carriage return or an unique command after each pot command. this makes parsing a little bit clearer.
also note that simpler to parse would be
with that format you could use the Separate (String) node to split the pot index from the value instead of the Regexpr (String) .
this also saves you from the next proposed vvvv faq entry
“how to convert something like a b c d to 0 1 2 3 4”
i still can’t make it work…
i have format the value this way:
0,1023 carriage return
1,23 carriage return
that was easy
but i still can’t make it work in vvvv
i use as a separator carriage return (ascii 13) in tokenizer
(when i use enqueue it doesn’t work at all, it work only in discard mode)
and (0,\d*) in first regExpr to get first pot value out
and (1,\d*) in second regExpr to get second pot value out
when i try all the regExpr code in one node it doesn’t work!
i use it like this (0,\d*)(1,\d*)
and what is a R at the end of the string node?
data has to much jitters and is useless…
do i miss something?
i have the att.