sending "0x01" as a binary buffer, either doesnt work, or im using it wrong.
However, I did get the drivers installed, and finally got the relay board working with the program the website above provided.
and could even control the relays with port listening software by sending these bit strings.
00000001 Relay one on
00000011 Relay one and two on
11111111 All relays on etc....
Each bit representing a relay, 0 for off, 1 for on.
However, I still could not find a solution for sending the byte string to my serial port directly from Node-Red Serial Node in the bit format above.
The new kernel's "echo" commands:
stty -F /dev/ttyUSB0 9600
echo -e '\xff\x01\x01' > /dev/ttyUSB0 // the relay 1 go ON.
stty -F /dev/ttyUSB0 9600
echo -e '\xff\x01\x00' > /dev/ttyUSB0 // the relay 1 go OFF.
Sample VB6 code :
Private Sub cmdOff_Click()
With MSComm1
'make sure the serial port is open
If .PortOpen = False Then .PortOpen = True
'send the data
.Output = Chr$(255)
.Output = Chr$(1)
.Output = Chr$(0)
End With 'MSComm1
End Sub
Private Sub cmdOn_Click()
With MSComm1
'make sure the serial port is open
If .PortOpen = False Then .PortOpen = True
'send the data
.Output = Chr$(255)
.Output = Chr$(1)
.Output = Chr$(1)
End With 'MSComm1
End Sub
Sample C# code :
private void button1_ON_Click(object sender, EventArgs e)
{
serialPort1.Write(new byte[] { 0xFF, 0x01, 0x01 }, 0, 3);
}
private void button1_OFF_Click(object sender, EventArgs e)
{
serialPort1.Write(new byte[] { 0xFF, 0x01, 0x00 }, 0, 3);
}
Any other Ideas? I am not sure where to go from here....