Last active
July 22, 2016 12:00
-
-
Save Workshopshed/8dec4ed8b89b3d89e5820114150f4bf7 to your computer and use it in GitHub Desktop.
A demo of the boards
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
#include "FastLED.h" | |
#define NUM_LEDS 14 | |
#define DATA_PIN 4 | |
CRGB leds[NUM_LEDS]; | |
void setup() { | |
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); | |
FastLED.clear(); | |
face(); | |
} | |
void loop() { | |
smile(); | |
FastLED.show(); | |
delay(350); | |
talk(); | |
FastLED.show(); | |
delay(350); | |
} | |
void face() { | |
smile(); | |
eyes(); | |
FastLED.show(); | |
} | |
void eyes() { | |
leds[0] = CRGB::Blue; | |
leds[2] = CRGB::Blue; | |
} | |
void smile() | |
{ | |
leds[7] = CRGB::Red; | |
leds[10] = CRGB::Red; | |
leds[11] = CRGB::Red; | |
leds[12] = CRGB::Red; | |
leds[13] = CRGB::Red; | |
leds[8] = CRGB::Black; | |
leds[9] = CRGB::Black; | |
} | |
void talk() | |
{ | |
leds[7] = CRGB::Black; | |
leds[10] = CRGB::Black; | |
leds[8] = CRGB::Red; | |
leds[9] = CRGB::Red; | |
leds[11] = CRGB::Black; | |
leds[12] = CRGB::Red; | |
leds[13] = CRGB::Black; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment