0

GPIO status and toggle switch

Hi,

I’m using an Event Handler set as initial state with 2 GPIO Event (Button 0 and 7) connected to lets say 2 images. Green.png and Red.png

GPIO 0 (green.png) and GPIO 7 (red.png) is connected to a toggle switch (non-momentary)

Problem occurs after player boots up in the morning as it doesn’t respond to an already closed contact. I need the player to know which state (GPIO 0 or 7) the toogle switch is in after boot to show the correct image. Tried “Press Contious” with no luck..

Should be easy but can’t figure out how to do.. any ideas?

Best regards

5 comments

  • 0
    Avatar
    Bright Scripters

    If I'm not mistaken, GPIO inputs must transition from high to low, in order to generate an event.

     

    You could make that work with a bit of electronics such as an optoisolator or a relay, that you would activate few seconds after the presentation starts. The relay or optoisolator, would be connected in series to the toggle switch, so should the switch be in its closed state, it would generate a single event upon presentation start. If the switch is open, no event would be generated.

    I think that a single GPIO input should suffice for this application, as you can respond to a button down, as well as button up events. Another GPIO as output would be required to drive the relay or optoisolator.

     

    With all that said, if you would consider a soft switch, instead of the toggle switch, you could use a User Variable, that you would manage from the BrightSign IOS App, or from a web browser. User variables can keep their values after a reboot.

  • 0
    Avatar
    Bright Scripters

    That was a hardware based solution, but there could be a software solution, by coding a BrightAuthor plugin.

    The plugin would respond to a message sent from BrightAuthor, which would invoke a BrightScript function call of

    IsInputActive(input_id As Integer) As Boolean

    The plugin would then respond by sending a plugin message back to BrightAuthor, that indicates the state of the toggle switch.

    BrightAuthor would then transition to the corresponding visual content.

     

    Upon presentation startup, you would need to send the plugin message, and transition accordingly.

     

     

  • 0
    Avatar
    Jaap

    Hi,

    Like Jonar I also looking for an software solution to evaluate the input high or low and trigger different content. We use a toggle switch for a project. Normally programming this in C would be as easy as a if statement.

    We use a toggle switch to trigger different languages. So the toggle switch has three states up/middle/down using two inputs if both inputs are low than the toggle switch is in the middle postion. I cannot upload the project to this forum as it only seems to accept images. In my project I store the last state using different zones to up and down events.  The problem with my project is that it forgets it last state after reboot you need to change the switch for the player to know it state.

    tried making a script using Bright Scripters suggestions but I already got stuck at the pizza example:

    https://docs.brightsign.biz/display/DOC/BrightAuthor+Plugins+and+Parsers

    I think sending example missing a function? The example is not downloadable. The example is also missing a related bright project example so I guess it is for the more experienced scripters

    Would be great if the functionality of toggle input would be build to BA or a plugin example would be added to:

    https://github.com/brightsign/BrightAuthor-Plugins

     

     

     

  • 0
    Avatar
    Jaap

    Hi,

     

    Here is my presentation:

    https://drive.google.com/open?id=1V1yEQGUd1cSFSncZphlz4oOmAtg0rdAc

     

    I tested on a BrightSign XT1144 it remembers the last state after being without power for about 12 hours. In the project are HD224 players used. They seem to forget the last state of the toggle switch.

  • -1
    Avatar
    Bright Scripters

    Hi,

    Thanks for the download link.

    The presentation seems to be correct, although I have not tested it on a player.

     

    Please be aware that user variables are stored in a database file on the SD card, so as long as the database exists, the variables values should be saved.

    Possibly what you are facing is timing related issue during initialization, as you have two timers triggering at the same time, and examining the same user variable. In theory that should not matter, but you never know...

    In order to reduce the chaos, I'd keep a single timer, out of the three that you have. It should still work. I'd also put the timer in its own zone, and separate it from the GPIO events.

    There are zone messages FR, EN, NL which don't seem to be used, so that timer could be easily eliminated.

    Other than that, it seems like you handled the toggle switch correctly, and had the right plan in mind.

     

    What is the behavior that you are seeing when the player "forgets" the laststate value?

    Our email is in the user name, if you'd like to contact directly.

Please sign in to leave a comment.