Setting Frequency on Digital Output

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="">Lua Scripting Guide</a>

Moderators: JeffC, stieg

Post Reply
Posts: 1
Joined: Wed Jan 06, 2016 3:28 am

Setting Frequency on Digital Output

Post by twhite84 »

How do I set the frequency on a GPIO output channel? I tried setting GPIO1 to Freq1 in the drop down and setting it to output, but there doesn't seem to be a switch for setting it's output frequency in a value through the scripting window. Basically I'm trying to change the frequency of the output based on an if statement. Below is a sample of what I'm trying to do.


function onTick()
local rpm = getTimerRpm(0)
local speed = getGpsSpeed()

if rpm == 0 then


Posts: 100
Joined: Fri Dec 20, 2013 1:37 am
Location: Madison, WI

Post by stieg »

Hi twhite84,

The GPIO ports are not designed for PWM style signal output. Rather you would want to use one of the four pulse/analog output channels for this task. You can find a diagram of the RCP pin outs by looking at the RCP pin-out diagram (1st link below). Then using the methods described in the LUA PWM / Analog Output functions (2nd link below) you will be able to control the frequency of those pins. Hope that helps.

RCP pin out diagram: ... _sheet.jpg
PWM / Analog Output functions: ... _functions
Andrew Stiegmann (Stieg)
Principal Engineer
Autosport Labs Inc.

Post Reply