How to use relay?



  • Re: Problems switching a relay

    Hi,
    I'm starting to program my new UniPi from netBeans. (installed on a Windows PC) My questions are the following:
    -How can I control the relay?
    -Do I need a specific library?

    Thanks,

    Alessandro.


  • administrators

    Hello @Alessandro,

    if you install default raspbian, then we provide TCP Modbus interface for all IOs except 1Wire communication. This has to be solved in a different way for example owfs.

    Or you can also use Evok which is in beta support for Neurons which provides additional APIs (websocket, REST api,...)

    https://github.com/UniPiTechnology/neuron_tcp_modbus_overlay

    https://github.com/UniPiTechnology/evok



  • First of all thank you for your fast answer. I'll give you some more details in order to let you understand better my problem:
    I installed the RASPBIAN JESSIE WITH DESKTOP on the UniPi and I'm moving the first steps in the programming. I connected the uniPi to my network. I installed netBeans on my windows PC and the library lbcm2835 to control the I/O. I realized the first "hello world" program in c++ that works well.
    Now I don't know (and I don't find any information on the web) wich command has to be used to activate the relay. This is the reason I'm asking you for.
    Thank you one more time,
    Alessandro.



  • @Alessandro
    lbcm2835 is used to access I/O pins on the Pi. UniPis do not use GPIO to handle output. There are internal ARM processors which are connected to the Pi via an SPI bus that handle the system's IO. The easiest way to access the relays would be to install the neuron tcp modbus overlay as stated above and access the relays through a c++ modbus library.