--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/be4a8cf9-8e26-4fce-8fdf-be2738d6ad25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ede,Can you give an example of what you tried with the Parse operator? When you say that "space represents cd+ln in the serial signal", do you mean that you use println to separate every single value?
Are letters and numbers intermingled in the stream?
It looks like the way the protocol is designed makes it much harder to parse, so the first think I would consider is whether it could be changed to make it easier. Can you use negative numbers to represent events, rather than letters? That would allow you to parse everything as signed integer values and simply check for negative and positive numbers to separate the two streams.
Otherwise, you may have to parse things manually inside a PythonTransform or ExpressionTransform, since I don't think Parse is flexible enough for this (it was designed for fixed protocol streams). You might be able to separate the two streams with a Condition using the Char.IsLetter(c) method to test the first character coming through and then applying Parse depending on the result.However, some clarification and example attempt would be useful to clarify what is being assumed here.
On 25 March 2018 at 14:53, Ede Rancz <eder...@gmail.com> wrote:
Hi Goncalo and others,I have a SerialStringRead producing a sequence of letters (e or d) and numbers (numbers can be anything 0-9999, not zero padded). The sequence is produced by an arduino using Serial.println(), so values are followed by carriage return and new line (ASCII13 and 10).Looks like this: d 0 9 0 0 12 e 120 9 0 where space represents cd+ln in the serial signal.I would like to catch letters (then convert e to 1 and d to 0 to feed into another part of the code) and also catch numbers (then timestamp and save them).I suspect parse and condition are the things I am looking for (or input / property mapping?) but can't make it work.Any tips?Ede
--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/ef8883e2-fef8-4751-a68f-4539e0930c04%40googlegroups.com.
Well Gonçalo I think parse is more flexlible than it looks at first time. You can also combine several Parse nodes in a bonsai workflow. So that you can solve more complex protocols. For instance You can parse the first part of the message as a integer followed by a string, where the string has the rest of the message. And then based on the value of the integer you can them parse the rest of the message using a branch where in each branch you use addicional parse nodes to parse the remaining string (the remaining of the message)
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/CAGV1SGKqDJi2NQ-qByieO-faQKF%2BgkCSZCp7vFPc7-VBb2x2cQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/ef8883e2-fef8-4751-a68f-4539e0930c04%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/CAGV1SGKqDJi2NQ-qByieO-faQKF%2BgkCSZCp7vFPc7-VBb2x2cQ%40mail.gmail.com.