implement first animation

This commit is contained in:
Ronald Schaten 2014-04-23 00:26:51 +02:00
parent 724f093748
commit 89a08e3066

View File

@ -50,11 +50,6 @@ void setup() {
analogWrite(LED_WHITE, white);
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
strip.animateColorAdd(255,0,0,100);
strip.animateColorAdd(0,255,0,100);
strip.animateColorAdd(0,0,255,100);
strip.animateStart();
}
void loop() {
@ -64,15 +59,25 @@ void loop() {
if (results.value != 0xFFFFFFFF) {
//if (results.value & IR_MASK == IR_FILTER) {
switch (results.value) {
case IR_KEY_1: Serial.println("key 1"); analogWrite(LED_RED, 0x00); break;
case IR_KEY_2: Serial.println("key 2"); analogWrite(LED_GREEN, 0x00); break;
case IR_KEY_3: Serial.println("key 3"); analogWrite(LED_BLUE, 0x00); break;
case IR_KEY_4: Serial.println("key 4"); analogWrite(LED_RED, 0x80); break;
case IR_KEY_5: Serial.println("key 5"); analogWrite(LED_GREEN, 0x80); break;
case IR_KEY_6: Serial.println("key 6"); analogWrite(LED_BLUE, 0x80); break;
case IR_KEY_7: Serial.println("key 7"); analogWrite(LED_RED, 0xFF); break;
case IR_KEY_8: Serial.println("key 8"); analogWrite(LED_GREEN, 0xFF); break;
case IR_KEY_9: Serial.println("key 9"); analogWrite(LED_BLUE, 0xFF); break;
case IR_KEY_1: Serial.println("key 1"); strip.animateStop(); analogWrite(LED_RED, 0x00); break;
case IR_KEY_2: Serial.println("key 2"); strip.animateStop(); analogWrite(LED_GREEN, 0x00); break;
case IR_KEY_3: Serial.println("key 3"); strip.animateStop(); analogWrite(LED_BLUE, 0x00); break;
case IR_KEY_4: Serial.println("key 4"); strip.animateStop(); analogWrite(LED_RED, 0x80); break;
case IR_KEY_5: Serial.println("key 5"); strip.animateStop(); analogWrite(LED_GREEN, 0x80); break;
case IR_KEY_6: Serial.println("key 6"); strip.animateStop(); analogWrite(LED_BLUE, 0x80); break;
case IR_KEY_7: Serial.println("key 7"); strip.animateStop(); analogWrite(LED_RED, 0xFF); break;
case IR_KEY_8: Serial.println("key 8"); strip.animateStop(); analogWrite(LED_GREEN, 0xFF); break;
case IR_KEY_9: Serial.println("key 9"); strip.animateStop(); analogWrite(LED_BLUE, 0xFF); break;
case IR_KEY_FADE:
Serial.println("fading");
strip.animateColorAdd(255, 0, 0, 100);
strip.animateColorAdd(255, 255, 0, 100);
strip.animateColorAdd( 0, 255, 0, 100);
strip.animateColorAdd( 0, 255, 255, 100);
strip.animateColorAdd( 0, 0, 255, 100);
strip.animateColorAdd(255, 0, 255, 100);
strip.animateStart();
break;
case IR_KEY_DIM:
white -= 0x10;
if (white < 0x00) {