Setting Frequency on Digital Output
Posted: Wed Jan 06, 2016 5:02 am
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.
setTickRate(10)
function onTick()
local rpm = getTimerRpm(0)
local speed = getGpsSpeed()
if rpm == 0 then
setFreq(0,10)
setAnalogOut(0,5)
else
setFreq(0,150)
setAnalogOut(0,0)
end
end
setTickRate(10)
function onTick()
local rpm = getTimerRpm(0)
local speed = getGpsSpeed()
if rpm == 0 then
setFreq(0,10)
setAnalogOut(0,5)
else
setFreq(0,150)
setAnalogOut(0,0)
end
end