Page 1 of 1
Flashing Warning Light
Posted: Mon Sep 18, 2017 4:17 pm
Preface: noob here when it comes to scripting.
I've seen the wiki example script for a warning light for say temperature, low pressure, etc.- is it possible to have this light flash, and what would that code look like? Thanks!
--Analog 0 is engine temp, in degrees F
--Analog 1 is oil pressure, in PSI
if getAnalog(0) > 212 or getAnalog(1) < 10 then
Posted: Wed Oct 04, 2017 5:42 pm
Hi, you'd have to have a separate counter that increments on every onTick(). A simple way is, if that value is odd, then make sure the output is off.
There are some shift light examples in our example library that implement something like this.
Let us know what you come up with!
Posted: Sat Apr 21, 2018 9:48 pm
Here's a script to make a light wired to GPIO(0) come on at a certain point and flash at a different point (like water temp). thanks to David Alexander.
--point at which light comes on
local waterOn = 195
--point at which light flashes
local waterBlink = 200
local timer = 1
if getAnalog(0) > waterOn then
if getAnalog(0) > waterBlink then
if timer == 1 then
timer = 2
else timer = 1
Posted: Wed May 09, 2018 6:17 pm
Nice, I'm going to try and implement that this weekend. I like the simple "on" along with "flashing" combo.
Posted: Wed May 09, 2018 7:03 pm
Just a thought. I've always used a redundant water pressure sender to a lite, completely independent of the digital gauges/sender. in dirt racing we are usually blowing hoses or poking holes in the radiator so you'll see a loss of pressure long before any rise in temp. sometimes you wont even see a rise in temp since a typical water temp gauge cant measure air temp (i.e no water in block). just food for thought.