Editing WingScreen
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 41: | Line 41: | ||
/* | /* | ||
* Serial control interface for LED Strip | * Serial control interface for LED Strip | ||
* Command Summary: | * Command Summary: | ||
* MODE0 == Auto (Rainbeau) | * MODE0 == Auto (Rainbeau) | ||
Line 55: | Line 47: | ||
* HH..H == Sequence of Hue values to apply to LEDs | * HH..H == Sequence of Hue values to apply to LEDs | ||
* Note: Set "MODE2" before sending hues | * Note: Set "MODE2" before sending hues | ||
*/ | */ | ||
Line 63: | Line 52: | ||
// How many leds in your strip? | // How many leds in your strip? | ||
#define NUM_LEDS | #define NUM_LEDS 12 | ||
// Spacing between pixel/color | // Spacing between pixel/color | ||
#define HSV_PAD | #define HSV_PAD 22 | ||
// Delay between cycles | // Delay between cycles | ||
#define LOOP_DELAY | #define LOOP_DELAY 20 | ||
#define DATA_PIN 11 | #define DATA_PIN 11 | ||
Line 77: | Line 65: | ||
CRGB leds[NUM_LEDS]; | CRGB leds[NUM_LEDS]; | ||
byte count = 0; | byte count = 0; | ||
byte mode = | byte mode = 0; | ||
byte hues[NUM_LEDS]; | byte hues[NUM_LEDS]; | ||
String inputString = ""; | String inputString = ""; | ||
void setup() { | void setup() { | ||
for (int i = 0; i < NUM_LEDS; i++) | for (int i = 0; i < NUM_LEDS; i++) | ||
Line 99: | Line 79: | ||
} | } | ||
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); | |||
FastLED.addLeds<WS2812B, DATA_PIN, | |||
FastLED.setBrightness(64); | FastLED.setBrightness(64); | ||
Line 118: | Line 91: | ||
void loop() { | void loop() { | ||
int i; | int i; | ||
if (mode == 0) | if (mode == 0) | ||
Line 139: | Line 97: | ||
for (i = 0; i < NUM_LEDS; i++) | for (i = 0; i < NUM_LEDS; i++) | ||
{ | { | ||
leds[i] = CHSV(count + (i * HSV_PAD), | leds[i] = CHSV(count + (i * HSV_PAD), 255, 255); | ||
} | } | ||
FastLED.show(); | FastLED.show(); | ||
Line 161: | Line 119: | ||
// Remote | // Remote | ||
} | } | ||
} | } | ||
Line 282: | Line 127: | ||
} | } | ||
FastLED.show(); | FastLED.show(); | ||
} | } | ||
void serialEvent() { | void serialEvent() { | ||
byte | byte count = 0; | ||
byte data; | byte data; | ||
Line 297: | Line 139: | ||
data = Serial.read(); | data = Serial.read(); | ||
inputString += (char)data; | inputString += (char)data; | ||
if ( | if (count < NUM_LEDS) | ||
{ | { | ||
hues[ | hues[count++] = data; | ||
} | } | ||
Line 306: | Line 148: | ||
delay(20); | delay(20); | ||
} | } | ||
Serial.println(inputString); | |||
if (inputString == "MODE0") | if (inputString == "MODE0") | ||
Line 318: | Line 162: | ||
{ | { | ||
mode = 2; | mode = 2; | ||
} | } | ||
else if (inputString.length() == NUM_LEDS) | else if (inputString.length() == NUM_LEDS) | ||
Line 339: | Line 167: | ||
updateHues(); | updateHues(); | ||
} | } | ||
else | else | ||
{ | { | ||
// WTF? | |||
} | } | ||
} | } | ||
Line 348: | Line 176: | ||
== Desktop Emulator == | == Desktop Emulator == | ||
[[File:HSV.jpg|960px]] | [[File:HSV.jpg|960px]] | ||
=== Main === | === Main === |