In a previous post there was some talk about how to make shiftlights flash. This is done automatically and is a very useful feature.
But what if we need other leds to flash or any other light for that matter. The math channels all work in a similar way.
In order to get LEDs to flash we normally use two math channels. One is the flasher frequency and the other is the control channel linked to the light.
In the ICD there is a special channel required to control the side LEDs, this is called Alarm Lights Pattern. The value of this channel dictates which LED switches on.
The value of the channel equates to each LED in the pattern seen below:
So if we want the bottom right light to come on we need the channel to output 128 and if we want the top left one to turn on we need the channel to output 1. We then simply add the numbers up to turn on multiple lights at the same time, 17 is the top two lights on, 136 is the bottom two and 255 turns all the lights on at the same time.
Imagine that we want the bottom right LED to flash when the oil pressure alarm is active and the bottom left when the water temp alarm is active.
First we have the flasher channel:
a1(choose(@a1 == 0, @a1+1, @a1-1));
Then the Alarm Lights Pattern channel looks like this:
this channel switches between 0 and 1 by adding or subtracting to itself based on the current value. So if the channel is currently zero then we add 1, then next current value is therefore 1 so we subtract 1.
The rate of flashing is the rate at which the math channel is calculated at, so if you want a slow flash set it to 1 or 2 Hz, a fast flash something like 10Hz.
choose([Alarm EOP Min] == 1, 128*[Flasher] || [Alarm EOT Max] == 1, 8*[Flasher], 0)
This channel reads as follows:
If(choose) oil Pressure alarm is set, turn on bottom right LED OR(||) if oil temp alarm is set turn on bottom left LED, else be 0.
By multiplying the output by the flasher channels we switch the lights on and off at the rate selected.