|
Sending data to serial port Paul D from Canada [45 posts] |
15 year
|
I have a USB realy switch on com3 that I am trying to control in RoboRealm.
The console area works great but I cannot get Send Sequence to work with a variable. The commands are:
ON: \xFF\x01\x01 or \255\01\01
OFF: \xFF\x01\x00 or \255\01\00
When I use the variable V_BELT in the send sequence the relay doesn't respond. The data logged in the console window appears the same; lines 459 and 460 are manually and have the desired effect:
Module Started ...
Connected!
00459: \255\1\0
00460: \255\1\1
00461: \255\01\01
00462: \255\01\00
00463: \255\1\1
00464: \255\1\0
This the serial module code:
<Serial>
<enable_send_sequence>TRUE</enable_send_sequence>
<flow_control_cts>FALSE</flow_control_cts>
<read_rate_index>-1</read_rate_index>
<send_frequency_index>-1</send_frequency_index>
<send_only_on_change>TRUE</send_only_on_change>
<baud>6</baud>
<data_bits>7</data_bits>
<port>COM3 - USB Serial Port</port>
<send>[V_RELAY]</send>
<flow_control_dsr>FALSE</flow_control_dsr>
<flow_control_out_x>FALSE</flow_control_out_x>
<flow_control_in_x>FALSE</flow_control_in_x>
</Serial>
I can resort to using MSCOMM in a vbscript module but I would prefer to stick with the serial module.
Any ideas.
|
|
|
Paul D from Canada [45 posts] |
15 year
|
The variable V_RELAY is the ASCII string \255\01\01.
It serial module seems to be sending the string as ASCII as the console displays the leading zeroes.
|
|
|
Paul D from Canada [45 posts] |
15 year
|
Figured it out.
In the send sequence I put
\255\01\[V_BELT]
V_BELT is either 01 to turn the relay on (closed) or 00 to turn it off (open).
I guess the send sequence is not intended to parse strings.
I found the realy board on e-bay. They come in in 1, 2 and 8 channels from:
http://www.sigma-shop.com/shop/
|
|