Guest User

Untitled

a guest
Sep 6th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. if (mm_per_s) //is the board moving?
  2.     {  
  3.         //moving the dot
  4.         nextLED = LED_ABSTAND / mm_per_s;
  5.         if ((micros() - nextLEDTimeOld) > nextLED)
  6.         {
  7.             leds_right[LED_position] += CHSV(255+turning, 255, 255);     //left LED
  8.             leds_left[LED_position] += CHSV(255-turning, 255, 255);      //right LED
  9.             LED_position++;
  10.            
  11.             nextLEDTimeOld = micros();
  12.             FastLED.show();
  13.             if (LED_position >= NUM_LEDS)       //wrap around
  14.                 LED_position = 0;
  15.         }
  16.     }
  17.  
  18.     //fading all LEDs
  19.     if ((millis() - fadingTimeOld) > FADING_TIME)           //tail for the light, longe fading time = longer tail
  20.     {                                                    
  21.         for (int x = 0; x < NUM_LEDS; x++) {                  //decrease brightness of all LEDs
  22.             leds_right[x].nscale8(180);
  23.             leds_left[x].nscale8(180);
  24.         }
  25.         fadingTimeOld = millis();
  26.         FastLED.show();
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment