Page 1 of 1

Virtual Channel help please

Posted: Mon Apr 22, 2019 10:53 pm
by ross2004
I'm trying to create a virtual channel called "StintTime" to serve as a driver stint timer. I'm attempting to pull the getUptime() command to pull the time the unit has been powered up (divided by 60,000 to convert to minutes). This is my first time I've tried creating a Virtual Channel so naturally I'm screwing it up. Does anyone have an idea what the trouble may be? RCP3 on 2.14.0

timerId = addChannel(“StintTime”,1,0,0,250,”min”)

function drivetime()
local time = getUptime()/60000
setChannel(timerId, time)
end

setTickRate(30)
function onTick()
drivetime()
end

[lua] Startup script error: ([string "timerId = addChannel( 201cStintTime 201d,1,0,0,250, 201dmin 201..."]:1.0: malformed number near '201cStintTime')
[lua] Failure: Failed to load script

Posted: Tue Apr 23, 2019 12:38 am
by BigLobsterDude
Check the double quote characters used around "Stint Time". I notice that that its different than than the quotes around "min". Might just be a posting anomaly, but I suspect your first quote character is not correct.

Posted: Tue Apr 23, 2019 12:59 am
by ross2004
Bravo sir! Thank you very much, somewhere along the way I assume copy/pasting back and forth from the Notes app the quotes got messed up. Now it's working perfectly. Thanks again!

Posted: Tue Apr 23, 2019 7:39 pm
by brentp
Tip, you could connect a GPIO to reset the stint timer. You could do it in such a way that a button press resets the count to 0.

Posted: Tue Apr 23, 2019 10:34 pm
by ross2004
True, but we power cycle the RCP at every pit stop, so that will serve us.