Sending an \r to TCP devices

Hello,

I'm trying to connect to an external device using the TCP/IP node. I need to send the command string ON followed by a carrage return \r. I've tried sending ON\r using the exchnage function and the inject function but this doesn't seem to work?

I can connect to the device in other programming languages such as labVIEW soi know the command is correct and the device is functioning.

The TCP node indicates that it is connected to the device and a debug node confirms the string has been past correctly but the device does not seem to accept the command - is there another way to send a carrage return so its not part of the string?

Many thanks!
Ollie

Change your inject node to the JSON type and input
"ON\r"
that should work.

Fantastic - I thought it would be something simple! I couldn't get it to work using the inject node as JSON but could using the change node - why is that?

Show us how you configured the Inject node (when you configured it as suggested) and what it gives if you feed that into a Debug node.

Should work the same:

When building raw tcp or serial data strings, I've generally used the inject node set to Buffer mode...

image

Click on the three dots ... on the right end of the input field to open the buffer editor -- then just type the string and hit the Enter key to add the "\r" to the end of the string:

image

You can see the trailing return 0A character in the bottom window...

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