Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (mm_per_s) //is the board moving?
- {
- //moving the dot
- nextLED = LED_ABSTAND / mm_per_s;
- if ((micros() - nextLEDTimeOld) > nextLED)
- {
- leds_right[LED_position] += CHSV(255+turning, 255, 255); //left LED
- leds_left[LED_position] += CHSV(255-turning, 255, 255); //right LED
- LED_position++;
- nextLEDTimeOld = micros();
- FastLED.show();
- if (LED_position >= NUM_LEDS) //wrap around
- LED_position = 0;
- }
- }
- //fading all LEDs
- if ((millis() - fadingTimeOld) > FADING_TIME) //tail for the light, longe fading time = longer tail
- {
- for (int x = 0; x < NUM_LEDS; x++) { //decrease brightness of all LEDs
- leds_right[x].nscale8(180);
- leds_left[x].nscale8(180);
- }
- fadingTimeOld = millis();
- FastLED.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment