Best way to make strings with hex/binary/unicode chars?

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.

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.  

Projector Schedule Hitachi 3.vuo (5.28 KB)

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  

Projector Schedule Hitachi 3.1.vuo (4.88 KB)

Thanks. I had a very different understanding of ‘Start of Day’! I’m attaching the binary control files zipped.

proj-control-codes.zip (1.41 KB)

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.

Projector Schedule Hitachi 3.2.vuo (6.89 KB)

Adrian,

We’re going to add Make Data from Bytes, Get Data Bytes, Append Data, and Cut Data nodes in Vuo 2.1. We’re hoping that release will be out in a few weeks.

2 Likes

Excellent!

Adrian,

One of our developers did some searching and thought this composition might work for your situation. Please let us know if you found it helpful.

sendcontrolcode.vuo (2.04 KB)

Thanks; I’ll give that a try shortly.