Guest User

sick LED patterns

a guest
Aug 30th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. //There are 2 programs here, duh.
  2.  
  3. //SICK LED SIN PATTERN feat. Madison
  4.  
  5. #include <FastLED.h>
  6.  
  7. CRGB leds[5];
  8. int t;
  9.  
  10. void setup() {
  11. FastLED.addLeds<NEOPIXEL, 2>(leds, 5);
  12. t = 0;
  13. for (int i = 0; i < 5; i++) {
  14. leds[i] = CRGB::Red;
  15. }
  16. }
  17.  
  18. void loop() {
  19. for (int i = 0; i < 5; i++) {
  20. leds[i].r = 0.2*sin8(t + i * 20);
  21. leds[i].g = 0.2*sin8(2 * t + i * 15);
  22. leds[i].b = 0.1 * sin8(2 * t + i * 20);
  23. }
  24. delay(10);
  25. t++;
  26. FastLED.show();
  27. }
  28.  
  29. //SICK GAUSSIAN WAVE PACKET feat. Madison again
  30.  
  31. #include <FastLED.h>
  32.  
  33. CRGB leds[5];
  34. int t;
  35.  
  36. void setup() {
  37. FastLED.addLeds<NEOPIXEL, 2>(leds, 5);
  38. t = 0;
  39. for (int i = 0; i < 5; i++) {
  40. leds[i] = CRGB::Red;
  41. }
  42. }
  43.  
  44. void loop() {
  45. for (int i = 0; i < 5; i++) {
  46. leds[i].r = 50 * exp(-0.2 * pow((i - fmod(0.1*t,14)+7) , 2));
  47. leds[i].b = 50 * exp(-0.2 * pow((i - fmod(0.1*(t+45),14)+7) , 2));
  48. leds[i].g = 50 * exp(-0.2 * pow((i - fmod(0.1*(t+90),14)+7) , 2));
  49.  
  50. }
  51. delay(20);
  52. t++;
  53. FastLED.show();
  54. }
Advertisement
Add Comment
Please, Sign In to add comment