Changing the LED Colors
Hello,
I'm trying to write an Android App that chnages the LED color depending on Data I get with a frequency of 60 Hz.
I'm using a Metawear CPro. The Data consists of one double value changing in a Range between 0 and 5. When connecting the CPro the LED should illuminate blue and stop after a while (works pretty well). If the Data value is under 2, the LED should turn green and if greater than 2 it should turn red. Still i get some problems with switching from green to red and viceversa. The LED lags behind a lot (around some seconds) and blinks even though it shouldn't. In addition it doesn't clear the LED patterns, meaning that the light sometimes is yellow, or even orange.
Is there anything I can do to get my LED playing just fine?
Here my code
(the ledToggle is a boolean switching between true and false depending on the data value)
if(ledToggle)
{
led.stop(true);
led = board.getModule(Led.class);
led.editPattern(Led.Color.GREEN)
.riseTime((short) 0)
.pulseDuration((short) 10)
.repeatCount((byte) 5)
.highTime((short) 5)
.highIntensity((byte) 16)
.lowIntensity((byte) 16)
.commit();
led.play();
}
else if(!ledToggle)
{
led.stop(true);
led = board.getModule(Led.class);
led.editPattern(Led.Color.RED)
.riseTime((short) 0)
.pulseDuration((short) 10)
.repeatCount((byte) 5)
.highTime((short) 5)
.highIntensity((byte) 16)
.lowIntensity((byte) 16)
.commit();
led.play();
}
This discussion has been closed.
Comments