0

BrightAuthor+OnBoard GPIO's Inputs+Autorun.brs



Hi all, I have a need to use the expander's GPIOs as outputs whenever an on board GPIO is pressed! For example: - If GPIO0 is pressed, then the expander GPIO8 is set to be active - If GPIO1 is pressed, then the expander GPIO9 is set to be active, etc. I knew from the other thread that BrightAuthor does not support the expander GPIOs settings and need to write a custom script to trigger them. Does anyone know where/which line of code in the standard autorun.brs (which comes after publishing a project using BrightAuthor) that handle the user's inputs from the on board GPIOs? Once I know this I can insert the code to set the expander's GPIOs! Thanks a lot in advance, Soulivanh

1 comment

  • 0
    Avatar
    RokuLyndon


    You'll need to make a few changes.

    The executecommand function is where external gpio settings would normally be applied.

    Inputs are handled in the waitforcsvevent function, which calls the HandleGpioEvent function. If you want to do something when a certain button is received, you would modify the HandleGpioEvent function.


    Most likely you would create a new gpio object:
    gpioEx = createobject("roControlPort", "Expander-Gpio")

    To enable your outputs:
    gpioEx.EnableOutput(7) 'for exampale


    To turn on gpio:
    gpioEx.SetOutputState(7, true)

    OFf:
    gpioEx.SetOutputState(7,false)


    Turn on this gpio, and turn all others off:
    gpioEx.SetWholeState(7)
Please sign in to leave a comment.