Hi Everyone,
I recently purchased what looks like the same relay-board module, so I was glad to see this conversation since mine has absolutely no specs or info with it.
I have not been successful in getting any kind of response from the board, aside from illuminating the USB LED on the board. When I unplug and re-plug the USB cable, I can hear all of the relays activating, so I’m pretty confident that it’s alive and well. Also, it’s pretty clear that this board is using COM5.
So here are my questions: am I supposed to have some sort of additional driver or the like, such as MacHIDMBS PlugIn that was mentioned in the initial posting or is the Xojo Serial control enough? I’m running on Windows, so I don’t have an option to use that. Is there a Windows version? Is it necessary when using the Xojo “Serial” control?
Regarding my code, I’m using the following (BTW, my Serial control is named TestSerial, which I hijacked from another Xojo example program):
In the Window “Open” event, I execute the following code:
TestSerial.SerialPort = System.SerialPort( SerialPortPopup.ListIndex ) 'this is also from the hijacked code...
'Communication Parameters:
'8 Data, 1 Stop, No Parity
'Baud rate : 9600
TestSerial.Bits=Serial.Baud9600
TestSerial.Stop=Serial.StopBits1
TestSerial.Parity=Serial.ParityNone
TestSerial.Baud=Serial.Baud9600
I’ve placed the following code in the “Action” event of a push button control… I’ve tried many variations of it, but this is pretty much what I’ve learned from this conversation. Please let me know where I’ve erred or if there’s something more that I need to do.
[code]Dim mb as new MemoryBlock(4)
dim res as integer
'Initialize the communication with the module
mb.byte(0)= &h0
mb.byte(1)=&h50 '255: single on, 253: single off, 254: all on, 252: all off
mb.byte(2)=&h51 'relay number (1-8)
mb.Byte(3)=&h0
TestSerial.write(mb)
TestSerial.flush
'Attempt to turn on all relays
mb.byte(0)= &h0
mb.byte(1)=&h252 '255: single on, 253: single off, 254: all on, 252: all off
mb.byte(2)=&h1 'relay number (1-8) - another bump to try to turn on relay 1
mb.Byte(3)=&h0
TestSerial.write(mb)
TestSerial.flush[/code]
I would greatly appreciate any help that you could offer - my autopilot lawnmower hangs in the balance! Thanks in advance for your help,
Don