How to get a mid-point value form a msg.payload

(Brain failure)

I get a msg.payload and it looks something like:
rgb,6,0,0,0

How do I parse the 6 in that - and make it a number.
I'm guessing that will be with parseInt()

But I can't for the life of me remember the command to split the payload and get the 6.

Short version

msg.output = parseInt(msg.payload.split(",")[1])

return msg;
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.