Custom: Accepting GPIO button presses and releases as button events

Important: These changes apply to BrightAuthor version 3.5 or earlier, and are not required in BrightAuthor:connected or later versions of BrightAuthor, which include button up or down options for GPIO events. 

GPIO_UpDown.png

If you want to be able to trigger events using both button presses and releases, there are two simple changes you can make to the autorun script that BrightAuthor publishes to allow this if you are not using BrightAuthor 3.8 or newer.  

Note: The following change does not work inside of media lists or inside the interactive menu object.

Step 1:  Find the RunBSP function

1. Search for this function

  • Sub RunBsp(sysFlags As Object, sysInfo As Object, diagnosticCodes As Object)

2. Find this line, which creates the gpio object:

  • BSP.gpioPort = CreateObject("roGpioControlPort")

3. Comment out this line and add the following line to create a roControlPort Object. The resulting two lines should look like this:

    • 'BSP.gpioPort = CreateObject("roGpioControlPort")
    • BSP.gpioPort = CreateObject("roControlPort", "Brightsign") 

Step 2: Find the MediaItemEventHandler function

1. Search for this function:

  • Function MediaItemEventHandler(event As Object, stateData As Object) As Object

2. Find this line, which checks for a button event:

  • if type(event) = "roGpioButton" then

3. Comment out this line and replace it with a line that checks for button up and button down events. A button down event is like the normal button press. A button up event is the release of that button.

  • 'if type(event) = "roGpioButton" then
  • if type(event) = "roControlUp" or type(event) = "roControlDown" then

Step 3: Publish your project with your custom autorun

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Can't find what you're looking for? Try to
Powered by Zendesk