USB Controlled Relay library

Post your working scripts, libraries and tools
x32
Posts: 61
Joined: 25 Nov 2016, 16:44

USB Controlled Relay library

13 Mar 2018, 07:53

A function library for USB Relay boards. See this post for capturing USB input.
https://www.banggood.com/5V-2-Channel-USB-Relay-Module-Programmable-Computer-Control-p-910097.html
Image

It only has one function, turn the relays on or off. There must be a second function, for finding the board serial number, but there are no instructions for it. A test app in the file downloads can be used to find it.

Requires the following files in the script directory.
1. CommandApp_USBRelay.exe
2. usb_relay_device.dll
3. GuiApp_English.exe ;;;;;; These last two are only for
4. XCGUI.dll ;;;;;; finding the device serial number.

File download links.
Original file, https://www.dropbox.com/sh/7clljb4h1aeb0m1/AAA-oUOCE2a15PC9BoMWY-Cha

Backup on my website, http://www.starshipgrissom.com/ahk/USB_Relay_Control.7z
This one includes copies of the library and a test script.

USBRelay(serial,oc,chan)
"serial" is your device's serial number.
"oc" is open or close. This is opposite of what would be expected, "open" activates the relay and "close" disconnects it.
"chan" is the relay chan, 1, 2, 3, ect. 255 controls all relays on the board.
Example - USBRelay(tk421,open,1)

I've only tested with a two channel board but I imagine it would work with any number of channels.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 6 guests