Page 1 of 1

Help using X2 relay and input from C#

Posted: 02 Dec 2020, 15:02
by untilted
Hi Kunbus support

I'm looking at RevPi Connect for a project and I need one 24v sense and one relay output so it looks like X2 connector will do the job, but the code will be in C# (mono) and I was wondering if I could get some help with some C# code or making a wrapper DLL in C that the C# could use

I saw the KB article "Statusbytes RevPi Connect" but didn't fully understand how I could apply it to a C# context; is anyone able to give an example how I might read the 0v/24v status of the X2 and activate/deactivate the relay? that article has some example C code using ioctl, but I couldn't see how to change the relay (I don't own a RevPi connect at the moment to look in the /home/demo folder) other than I guess it's some other byte address?

In short, if someone said "here you go; it's the C# pinvoke code that will use ioctl to read/write the X2" then that would be amazing but if there was any help towards that, even like "here is a simple c program that can compile to dll and use from c#" .. or maybe even some help on if X2 can show as virtual device like /sys/class/gpio

Re: Help using X2 relay and input from C#

Posted: 03 Dec 2020, 15:07
by dirk