I wish to send a binary control code over a serial connection and not sure how best to encode this into the string for 'Send Serial Data'. I found the 'Make Text from ASCII' Node so should I use that for each char with 'Append Texts'? I was half expecting to find a way to escape special chars into a string but if it's there I couldn't find it :-)

Thanks.

Comments

It turns out there is a

dr.drainaway's picture
Submitted by

It turns out there is a limitation with the approach described above: it won't handle zeros probably (presumably because they're considered to terminate the preceding characters/string?) So I'm reading an external file I create manually and then outputting that to the serial port. I'd prefer a self-contained method so would still welcome any suggestions.

The task I'm working on is scheduling projector power on/off times for an installation via its RS232 control codes.

I've run into some strange behavior with 'Is Time-of-Day After' which I might write up separately; it doesn't return True if the current time is many hours past the test time. Composition attached.

Hi ;)

Bodysoulspirit's picture
Submitted by

Hi ;)

Joined is your composition modified that should turn on/off the projector (Projector Schedule Hitachi 3.1) if I'm right.
I think you have to reason in 24h time, and set the Start Of Day of each "Is Time After" node to be the opposite on/off value.

Regarding the text to send as data I'm no expert at all, but might help if you can paste how the final text / data to be sent should look like.

Cheers

Glad it helped already.

Bodysoulspirit's picture
Submitted by

Glad it helped already.

Ok the code part is beyond my skills. Tried to play with it using https://www.rapidtables.com/convert/number/binary-to-ascii.html but came nowhere to understand it ;)

Joined is the composition with in magenta other nodes that might help. Instead of manually typing each character, maybe you can split it using the Make Text From Control Code. Also, when you click on a node, below in its description you might find some sample compositions (see screenshot).

From there, if possible to embed & convert the text to data in the composition, just have the latest true push the right data into the send data node.