Skip to content

Commit

Permalink
added ino-file that controls the leds
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas Engelhard committed Oct 28, 2018
1 parent 7ae2312 commit 6744a32
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions arduino/warning_leds.ino
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);
}


0 comments on commit 6744a32

Please sign in to comment.