0

GPIO - Using both states of an input as actions (on same media)

Hi,

Brightsign newbie here...

  1. Trying to begin playback with a GPIO event ("press" or "rising edge"), and stop playback and return to previous state with the corresponding input event ("release" or "falling edge"). 
  2. on a separate media file triggered by a different GPIO input event (press, or rising edge), I would like to ignore subsequent GPIO input events (presses or releases) during playback so as to not interrupt playback until media end is reached, HOWEVER, once media playback is done, I'd like a GPIO input (either the press, or the release) to "return to prior state"

Any hints would be greatly appreciated - Thanks!

(Happy to include the BA project if needed)

 

 

 

9 comments

  • 0
    Avatar
    Alex

    Hi,

    This faq shows you how to modify the autorun script published by BrightAuthor to allow for button up and down: http://support.brightsign.biz/entries/23036598-Custom-Listen-for-Gpio-button-presses-and-releases-button-up-and-down-

    With the changes, both button presses and releases would be seen as button events. So, pushing button 1 and releasing button 1 would be seen as button 1 by BrightAuthor.

    Here's a picture of what a project may look like.

    gpionoff.JPG

    In this example we have 4 images we're playing with gpio presses, and the release, same gpio event, takes us back.

    The modified autorun.brs file is attached at the bottom of this post. This customization was tested with BrightAuthor 3.5.0.24.

    If you use BrightAuthor 3.5.0.24, all you need to do is add this newer autorun to your published playlist on the SD card. Or you can go to File, Presentation Properties, Autorun, Custom, and this autorun to your project file so when it's published this custom one gets used, and not the standard one. See directions in this faq: http://support.brightsign.biz/entries/23697378-How-to-add-a-custom-script-to-a-BA-presentation-

    If you use a different BrightAuthor version, you need to make the modifications in autorun script yourself.

  • 0
    Avatar
    Eran Sharon

    Thank you for the quick and detailed reply. I believe what you are describing is how to make bright sign treat each occurrence of a press and a release of button 1 as a press of button 1. i may be wrong but this means I cannot distinguish between the two in my interactive application. To make sure I relayed my question properly:

    • When you press button 1, movie 1 starts playing
    • When you release button 1, movie 2 starts playing. 
    • Please note that movie 2 does not play when button 1 is pressed, nor does movie 1 stop when button 1 is released.

    Lastly, i am using BA 3.7.0.37 (but can also use 3.5.0.36). Can you please point a beginner to (or at least highlight) the modifications I'd need to perform to the linked AutoRun.brs? Alternatively, is there a "standard" Autorun.brs for 3.7.0.37 that i can use to copy paste the functionality into?

    Thank you very much - ES

  • 0
    Avatar
    Lyndon

    Each brightauthor version has its own autorun.  Yes, the changes would make it so the unit wouldn't distinguish between a press an a release. But, you can't press a button if it hasn't been released. 

    So, once button 1 is pushed, it can't be pushed again until it has been released. So if pushing button 1 takes you to video 1, then if you are listening for a second "button 1" to take you to video 2, then the only button 1 you can see will be the release of button 1. 

  • 0
    Avatar
    Lyndon

    With ba version 3.7.0.37, make the changes here:

     

     

    Find this function definition:

    Sub GPIOEventHandler(event As Object)

    Change the first line from this:

    if m.state$ = "ButtonUp" then


    to this:

    if m.state$ = "ButtonUp" or m.state$ = "ButtonDown" then


    Change this line:

    m.state$ = "ButtonDown"


    to:

    if m.state$ = "ButtonUp" then
    m.state$ = "ButtonDown"
    else
    m.state$ = "ButtonUp"
    Endif

     

     

  • 0
    Avatar
    Eran Sharon

    Thank you!. after experimenting with this mode in 3.7.0.37, I decided that not knowing the discrete exact state (rising vs falling edge) makes the experience unreliable...things got out of sync really quickly - you'd be surprised how museum visitors can mess up any simple automation logic.

     

    I will suggest a feature to add a "release" option to the current "press" and "press continuous" options.

     

    Thanks again for the help!

  • 0
    Avatar
    Lyndon

    It's possible to account for the state. You could create a variable in the project, and in the same customization above, you could set the value of the variable depending on the state the button is in. Then, in your project, you can have conditional triggers. So, you can have a press do something unless the variable value is down, or unless it's up..

  • 0
    Avatar
    Eran Sharon

    Now why didn't i think of that?. this is how we used to track power states for non-discrete IR power commands... 

    Thank you!

  • 0
    Avatar
    Lukas Uebachs

    I've a similiar problem, but it seems the suggested solution doesn't work for me.

    I use a HD120 with BA 3.7 and 4 GPIO inputs.

    One of the inputs (GPIO 0) is connected permanently (ButtonDown?) when a headphone is taken from its wallmount.

    3 buttons are for language selection and will trigger a short connection (ButtonDown - ButtonUp).

    I would like to achieve, that every time the headphone is replaced to its wallmount (GPIO 0 - disconnected - ButtonUp?) the presentation goes back to initial state.

    I made the changes to autorun.brs as describe, but it doesn't work. Presentation hirachy in attached picture.

     

  • 0
    Avatar
    Lyndon

    Let's try a different method that doesn't require changing the autorun. So, remove the custom autorun. By the way, this is a standard feature in the upcoming 3.8 brightauthor software.

    In this version we aren't using gpio events in the project. The plugin processes the gpio buttons pushes, and when a button is released, sends a text message using a plugin event. So, if you press button 4, and release it, the plugin sends "b4" as a plugin event.

     

    So, in your project, you use the plugin event type to trigger your different content, b1, b2, b3, b4, etc.  See the attached image. When you add this plugin to your project, it will ask you for a plugin name. use "custom", without the quotes. 

    You add the plugin under file, presentation properties, autorun, add plugin. 

     

Please sign in to leave a comment.