USB Relay control with swift... possible?

New to Swift. Have done a quick search here and did not find what I was looking for.


Im going to try to create a graphical user interface that will control aprox 30 double Pole switches through a USB relay control boards.

Before I dive in to deeply... is this possible? I have spent the day looking and I can not find any resources to control USB relays with the mac OS online.


Not sure what other info i can provide. I would like to start with the application runnning on the OSX. Then possibly some wireless stuff.

But would like to get a small scale proof of concept running.


Any information will be greatly appreciated


Thanks

Bob

There are two key references here:

Using I/O Kit from Swift is quite tricky, and is certainly not something covered by those docs. If I were in your shoes I’d probably start by getting something up and limping in Objective-C.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

If not possible to control usb relay boards, is it possible to control an arduino from an Mac OS appication wich in turn controls the relays.


Bob

Hello lorusso,

You can certainly interface with an Arduino. But I suggest looking at an easier-to-use USB interface like libusb (libusb.info). It will be in C, but you should be able to call that from Swift.

John,

I donloaded libusb and there is a folder with XCode in it.

can I use that code along with XCode/Swift to connect the software to a USB relay?


Im really struggling to believe that it is this hard to click a button on a computer and a USB relay snaps.

I have mechanical switches hooked to my computer that are instantly recongnised and can be assigned to control a function in software. why cant it be that simple in reverse?

I must really be missing something.


Thanks for your help

Any adives or suggestions


Bob

Seen this?


h t t p s / / www.mac-usb-serial.com/wordpress/serial-port-programming-swift-mac-os-x/


Bit dated, but it appears to check all your boxes...

USB Relay control with swift... possible?
 
 
Q