Last active
August 29, 2015 14:14
-
-
Save harrisonhjones/d315732f278cd523b1bf to your computer and use it in GitHub Desktop.
RGBEffect Demo 1
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 "RGBEffect.h" | |
RGBEffect led; | |
// Define a color sequence of 6 colors | |
unsigned int colorSeq[6] = {1,2,3,4,5,6}; // Red, White, Blue, Green | |
void setup() { | |
Spark.function("blinkon", blink); | |
Spark.function("blinkoff", blinkoff); | |
// Define a few colors | |
led.setColor(0,0,0,0); // Dark / Off | |
led.setColor(1,255,0,0); // Red | |
led.setColor(2,255,255,0); // Yellow | |
led.setColor(3,0,255,0); // Green | |
led.setColor(4,0,255,255); // Cyan | |
led.setColor(5,0,0,255); // Blue | |
led.setColor(6,255,0,255); // Magenta | |
led.setColor(7,255,255,255); // White | |
// Set the delay to fairly quick blink | |
led.setDelay(150); | |
// Blink the LED | |
led.blink(colorSeq,6); | |
} | |
void loop() { | |
led.update(); | |
} | |
int blink(String args2){ | |
led.blink(colorSeq,6); | |
return 10; | |
} | |
int blinkoff(String args1){ | |
led.off(); | |
return 20; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment