On the Raspberry Pi I connect to the USB input a module that has 8 A/D inputs.
The module sends to the serial port every 500 MS the reading of 8 channels in analog input.
I need a function that will filter the channel I use let's say ch1
Which function will do this?
this is a sample reading "
"CH1: 2004 > 1.645V"
"CH2: 2134 > 0.640V"
"CH3: 2304 > 1.145V"
''
"CH8: 3304 > 1.005V"
Are these seperate msg's? If so, and if the string is in msg.payload, you could use a switch node to use the 'contains' option and compare it to the channel number you want to pass thru, like 'CH2'
Are you sure you want a string "CH2: 0.640V"
and not a javascript object {CH2: 0.64}
which, if it was in msg.payload, would allow you to use msg.payload.CH2 to access the value 0.64
How have you configured the serial port? Try setting it to split on \n and it may give you separate messages. If that doesn't work feed the message into a debug node and show us what it looks like.