I'm hoping someone can take quick look at the simple scripts I'm trying to run on my racecapture pro v3.
Basically I have the three GPIOs set to output mode and connected to a relay board. The intent of my scripts are just to cycle normally open and normally closed relays based on measured values. Seems really simple, and I looked at plenty of examples, but still can't get mine to work correctly.
I'm sure I'm just missing some basic syntax... this is definitely not my wheelhouse.
Error code when running the following script:
Script error: [string "function accusump()..."]:3.0: attempt to compare boolean with number
------------------------------------------------------------------------------------------------------------------
function accusump()
local rpm = getTimerRpm(0)
if 400 < rpm < 1750 then
setGpio(0, 1)
println ("Accusump Disabled")
else
setGpio(0, 0)
println ("Accusump Enabled")
end
end
function GenAlarm()
local OilPress = getAnalog(0)
local OilTemp = getAnalog(1)
if OilPress < 15 or OilTemp > 220 then
setGpio(1, 1)
println("panic")
else
println("No Panic")
setGpio(1, 0)
end
end
function onTick()
accusump()
GenAlarm()
end
-------------------------------------------------------------------------------------------------
Lua Script Error - attempt to compare boolean with number
Moderators: JeffC, rdoherty, stieg, brentp
-
- Posts: 6
- Joined: Wed Mar 16, 2022 11:52 pm
Lua Script Error - attempt to compare boolean with number
- Attachments
-
- lua script woes.PNG (114 KiB) Viewed 7601 times
-
- Posts: 6
- Joined: Wed Mar 16, 2022 11:52 pm
Re: Lua Script Error - attempt to compare boolean with number
Found the problem, just needed an AND
function accusump()
local rpm = getTimerRpm(0)
if 400 < rpm AND rpm < 1750 then
setGpio(0, 1)
println ("Accusump Disabled")
else
setGpio(0, 0)
println ("Accusump Enabled")
end
end
function accusump()
local rpm = getTimerRpm(0)
if 400 < rpm AND rpm < 1750 then
setGpio(0, 1)
println ("Accusump Disabled")
else
setGpio(0, 0)
println ("Accusump Enabled")
end
end