-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ino-file that controls the leds
- Loading branch information
Nikolas Engelhard
committed
Oct 28, 2018
1 parent
7ae2312
commit 6744a32
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include <Arduino.h> | ||
#include <FastLED.h> | ||
|
||
#define NUM_LEDS 68 | ||
#define DATA_PIN 6 | ||
|
||
|
||
CRGB leds[NUM_LEDS]; | ||
|
||
void setup() { | ||
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS); | ||
FastLED.setBrightness(84); | ||
Serial.begin(115200); | ||
} | ||
|
||
void loop() { | ||
//leds[0] = CRGB::Red; | ||
|
||
if (Serial.available() > 0) | ||
{ | ||
int incomingByte = Serial.read(); | ||
|
||
if (incomingByte == 'w') | ||
{ | ||
// Serial.println("WARNING"); | ||
FastLED.setBrightness(100); | ||
for (int i=0; i<NUM_LEDS; ++i) | ||
{ | ||
leds[i] = CRGB::Yellow; | ||
} | ||
} | ||
|
||
if (incomingByte == 'd') | ||
{ | ||
FastLED.setBrightness(100); | ||
// Serial.println("DANGER"); | ||
for (int i=0; i<NUM_LEDS; ++i) | ||
{ | ||
leds[i] = CRGB::Red; | ||
} | ||
} | ||
|
||
if (incomingByte == 'g') | ||
{ | ||
FastLED.setBrightness(40); | ||
// Serial.println("DANGER"); | ||
for (int i=0; i<NUM_LEDS; ++i) | ||
{ | ||
leds[i] = CRGB::Green; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
FastLED.show(); | ||
delay(30); | ||
} | ||
|
||
|