Skip to content

Commit

Permalink
Intial LED lightup code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhananjay Balan committed May 3, 2017
1 parent 88ec673 commit 01ef6b4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
5 changes: 5 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[env:uno]
; lib_install = fastled
platform = atmelavr
framework = arduino
board = uno
42 changes: 42 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* LED Strip host.
*
* Turns LEDs red (for now)
*/

#include "Arduino.h"
#include <FastLED.h>

#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif

#define NUM_LEDS 300
#define DATA_PIN 6

CRGB leds[NUM_LEDS];
int count = 0;

void setup()
{
// Init fastled
FastLED.addLeds<WS2812, DATA_PIN, BGR>(leds, NUM_LEDS);
}

void loop()
{
int i;
for (i=0;i<=count;i++)
leds[i] = CRGB::Blue;

for (;i<NUM_LEDS;i++)
leds[i] = CRGB::White;

count++;
if (count >= NUM_LEDS)
count = 0;

FastLED.show();
// wait for a second
delay(100);
}

0 comments on commit 01ef6b4

Please sign in to comment.