Sonic, OSC, node-red, senseHat on pi

This might be of interest to someone (!?!) - Huge learning curve of sonic, OSC and node-red at same time - not much real info out there…
on sonic:-

use_osc "b.local", 4561
osc "/topic1/subtopic1", "Hello Zac"
sleep 10
osc "/topic2/subtopic2", "[0,1,2,3,4]"

Note the zeroconf / bonjour address used on Linux (a raspi 4 sonic 3.2.2), The examples are a bit more useful as they have some data in the payload.

It gives this on node red on the other system and plays the message on the senseHat led’s screen:-

04/06/2020, 13:54:19node: e751c409.7ac938
/topic1/subtopic1 : msg.payload : string[9]
"Hello Zac"
04/06/2020, 13:54:29node: e751c409.7ac938
/topic2/subtopic2 : msg.payload : string[11]
"[0,1,2,3,4]"

Nice work! Inspires me to have a go…

If you want to invert or colour the text, this node-red function might help (took me a while to get it right!!):-

node.send( { payload:"R180" } ); //senseHat invert screen
msg.color="red"; //sense hat red text
return msg;

hi @richrarobi,

Could you please use 3 backticks at the beginning and at the end of a code block to highlight it. One single backtick is for inline code.

Thanks

yes, no problem… I knew it wasn’t right. Is there an option at the top ? I couldn’t decide which would be right… between blockquote and highlighted text… ? yup! a lot clearer.

1 Like

This also may be of interest: (learning curve flattening a bit)
On another pi I have voice using flite (festival lite). Now sonic-pi can talk…Note the better formed JSON…



The function checks for a flite voice option:-


RichR
p.s. I am not using the topic properly, but this could be used to select different node-red operations.

minor bug - null should not be in quotes in the function!!!

1 Like