Facility Control

 View Only
  • 1.  GPIO state reading

    Posted 09-28-2023 16:40

    Hi

    I have a custom panel with a button that is triggered by GPIO 10, when the GPIO is On i what it to turn on the projector and when the GPIO is off turn off the projector. What i need help with is editing the example script below to suit my requirement as in put the state into a varable to use in an if statement



    ------------------------------
    Andrew Diggins
    Engineer
    Kinly
    ------------------------------


  • 2.  RE: GPIO state reading

    Posted 10-02-2023 15:59

    Hi Andrew,

     An example of how you can put the state in an if statement can be:

    if (event.getState && event.getState() != null)
     {
       //Do the thing
     }

    Hope this helps.

    Best Regards,



    ------------------------------
    Altaz Daruwala
    Ross Video
    ------------------------------



  • 3.  RE: GPIO state reading

    Posted 10-02-2023 17:28

    Hi Altaz

    Thank you very much for the reply..So would this work

    if (event.getState && event.getState() != 1)
     {
       //turn on projector
     }
    
    if (event.getState && event.getState() != 0)
     {
       //turn off projector
     }


    ------------------------------
    Andrew Diggins
    Engineer
    Kinly
    ------------------------------



  • 4.  RE: GPIO state reading

    Posted 10-04-2023 15:19

    Hi Andrew,

    Assuming that the GPIO 10 returns 1 when the projector is on and 0 when it is off, I can confirm that the above code should work.

    Best Regards,



    ------------------------------
    Altaz Daruwala
    Ross Video
    ------------------------------