Serialport device

#1

Hi,

I have this usb GPIO board.

I can send commands to that by using screen in mac terminal.
In node red I can see, that it is connected, but when using same commands, nothing happens. I only get back the same command I send.

Can anyone help what I do wrong?

0 Likes

#2

Might not make a difference, but have you tried using the serial request node instead of the separate serial in/out nodes?

0 Likes

#3

Thanks for the suggestion, I tried also serial request, but result is the same.

0 Likes

#4

When you send a command to the serial port do you have the correct line ending (enter) that the board requires ?

0 Likes

#5

Got it working. I added function node and entered command and \r.

Thanks for help!

29

1 Like

#6

Great - yes sometimes it's \n and sometimes \r.
Well done. Onwards !

0 Likes

#7

At one time there was a suggestion to allow the inject and maybe change nodes to allow the \r string to represent a carriage return... +1 for that feature, especially if it could be added to the template node as well.

0 Likes

#8

"hello\r" is valid JSON so you can set the inject to JSON mode and use that if you wish

0 Likes

#9

Aha, tricky -- I guess I never tried using JSON mode...
Do you have a trick like that for including returns in the string generated by the template node?

0 Likes

#10

same trick - output JSON string instead

[{"id":"8391e8de.aa36d8","type":"inject","z":"9da3d17d.f408","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":120,"wires":[["23a2da8d.6a8896"]]},{"id":"23a2da8d.6a8896","type":"template","z":"9da3d17d.f408","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"\"This is the time: {{payload}}\\n and line two !\"","output":"json","x":280,"y":120,"wires":[["3a5187f5.671688"]]},{"id":"3a5187f5.671688","type":"debug","z":"9da3d17d.f408","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":120,"wires":[]}]
0 Likes