Advertisement
Guest User

Untitled

a guest
Nov 8th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. void loop() {
  2. // put your main code here, to run repeatedly:
  3.  
  4. FadeUp();
  5.  
  6. }
  7.  
  8. void FadeUp(){
  9.  
  10. if(leds[NUM_LEDS - 1].g < 255)
  11. {
  12. leds[NUM_LEDS - 1].g = (leds[NUM_LEDS - 1].g + 1)*2;
  13. if(leds[NUM_LEDS - 1].g > 255)
  14. {
  15. leds[NUM_LEDS - 1].g = 255;
  16. }
  17. }
  18. for(int i = NUM_LEDS - 2; i>=0; i--)
  19. {
  20. if(leds[i+1].g > 2 && leds[i].g < 255)
  21. {
  22. leds[i].g = (leds[i].g + 1)*2;
  23. if(leds[i].g > 255)
  24. {
  25. leds[i].g = 255;
  26. }
  27. }
  28. }
  29.  
  30. FastLED.show();
  31. delay(60);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement