Adding LED controller fw

This commit is contained in:
Max Hunt 2018-09-26 19:01:06 +01:00
parent d07caeb492
commit 49202a2e64
2 changed files with 34 additions and 0 deletions

BIN
Design/32U4PinMapping.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -0,0 +1,34 @@
#include <FastLED.h>
#define NUM_LED 4
#define LED_PIN 7
CRGB led[NUM_LED];
void setup(){
FastLED.addLeds<NEOPIXEL, LED_PIN>()LED, NUM_LED;
for (int i = 0; i < NUM_LED; i++) {
led[i] = CRGB(0, 0, 255);
}
FastLED.show();
}
void setAll(int red, int grn, int blu){
for (int i = 0; i < NUM_LED; i++){
led[i] = CRGB(red, grn, blu);
}
FastLED.show();
}
void setQ(int red, int grn, int blu){led[0] = CRGB(red, grn, blu);}
void setW(int red, int grn, int blu){led[1] = CRGB(red, grn, blu);}
void setA(int red, int grn, int blu){led[2] = CRGB(red, grn, blu);}
void setS(int red, int grn, int blu){led[3] = CRGB(red, grn, blu);}
void show(){FastLED.show();}
void loop(){
setQ(255, 0, 0);
setW(0, 255, 0);
setA(0, 0, 255);
setS(255, 0, 255);
show();
delay(30000);
setAll(0, 255, 255);
delay(3000);
}