GPIO Output

Revision as of 02:36, 28 July 2019 by Sbarton (talk | contribs)

GPIO Output to control switches, relays, LEDs, etc

GPIO on the Race Capture Pro devices can be used to control switches, relays, LEDs, and other small devices with a load of 1A or less. If the load is larger than 1A you can use a SPST relay to control it. When in Output mode the GPIO channel will connect to Ground when active and will be open when not active. This means that instead of using the Race Capture Pro to provide power to your switch, relay, or LED, you will use it to provide ground to turn it on instead.

Relays

If you have a device you want to control that requires more than 1A, you will need to use a Relay to power it. Normally a SPST relay would have a constant 12v, constant Ground, 12v Output, and input 12v that triggers the relay and sends 12v to the Output. To control a standard 4 pin SPST Relay with RCP, You would have constant 12v, but instead of switched 12v input, that will now also always be hot, and instead of constant ground, you will have switched ground controlled by the RCP.

RelayStandard.jpg RelatRCP.jpg


LEDs

Most small LED indicator lights can be controlled directly with RCP. Wire power directly to the LED, and wire the ground to the GPIO of the Race Capture Pro. Triggering the GPIO of the RCP will ground the LED turning it on.


Lua Scripting for GPIO's

In order to turn on a GPIO you need to do so with in the Lua script. Once turned on(ie. setGpio(1,1) , it will stay on until you explicitly turn it off (ie. setGpio(1,0)

setGpio ( channel, state )

Sets the state of the GPIO channel when the channel is configured for output mode.

  • params
    • channel: integer 0 - 2
    • state: (int / (since 2.10.0) bool) 1 / true = output active; 0 / false = output inactive
  • returns:
    • none

When the state specified is 1, the output is active (transistor is connected to ground). When state is 0, transistor is disconnected, and pullup resistor is active.

When configured for input mode this function has no effect.