Skip to content

Instantly share code, notes, and snippets.

@AlexJWayne
Created February 17, 2015 00:55
Show Gist options
  • Select an option

  • Save AlexJWayne/a9279ba8fc249b54d317 to your computer and use it in GitHub Desktop.

Select an option

Save AlexJWayne/a9279ba8fc249b54d317 to your computer and use it in GitHub Desktop.
#define SENSOR_START_INDEX 4
#define SENSOR_END_INDEX 8
void loop() {
bool sensorIsTripped = readFromSensor();
for (var i = 0; i < NUM_LEDS; i++) {
if (sensorIsTripped && i >= SENSOR_START_INDEX && i < SENSOR_END_INDEX) {
leds[i] = CGRB::Green;
} else {
leds[i] = CRGB::Red;
}
}
FastLED.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment