Code: Select all
//note: battery only seems to update at 5% intervals.
//green if above 50%
if(battery<=1 && battery>=0.49){
setattribute(BatteryIndicator,'color',RGB(0,1,0));
}
//yellow if between 50% and 20%
if(battery<=0.5 && battery>=0.21){
setattribute(BatteryIndicator,'color',RGB(1,1,0));
}
//red if 20% or less
if(battery<=0.2){
setattribute(BatteryIndicator,'color',RGB(1,0,0));
}
//pulse is 10% or less
if(battery<=0.1){
setattribute(BatteryIndicator,'light',sin(time*10)*2);
}