Page 1 of 1
serial data string out if switch activated
Posted: Sunday 19 July 2020 9:31
by Dave21w
Is it possible to send a predifined string of ascii characters out of the serial port (or usb) when a specific switch is activated ?
Thx
Re: serial data string out if switch activated
Posted: Sunday 19 July 2020 9:50
by waaren
Dave21w wrote: Sunday 19 July 2020 9:31
Is it possible to send a predifined string of ascii characters out of the serial port (or usb) when a specific switch is activated ?
Did you try this bash command? (after changing /dev/ttyUSB0 to the port you want)
Code: Select all
sudo echo "predefined string" > /dev/ttyUSB0
If that works you can use dzVents, Lua or Blockly, PHP or other scriptlanguage to do this using os.execute() when the specific switch is activated.
Re: serial data string out if switch activated
Posted: Sunday 19 July 2020 10:49
by Dave21w
Thanks for the quick response Waaren, I'll give that a try later and report back

Re: serial data string out if switch activated
Posted: Sunday 19 July 2020 19:30
by Dave21w
Hopefully some one can give me a quick answer on this, I have an FTDI USB to serial converter plugged into the USB port, it's being seen as:-
Bus 001 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
I've followed the previous instructions in this thread, I'm seeing nothing coming out but not getting any errors on screen either, what am I missing?
Thx
Re: serial data string out if switch activated
Posted: Monday 20 July 2020 19:53
by Dave21w
Really need some help here guys, trying to send my txt string as per Warren's instructions, the data gets sent but ignored because of some extra characters that are being appended to the start, here is what I'm sending:-
sudo echo -en "#A,0,1,0442187,0,test message" > /dev/ttyUSB0
And this is what is coming out:-
^@0#A,0,1,0442187,0,test message
The first three characters should not be there, does anyone have any ideas?
Thx