Guest User

ArduinoUNO_Code_Heart_Lamp

a guest
May 26th, 2022
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. //Include FastLED.h
  2. #include <FastLED.h>
  3. //define numbers of led
  4. #define NUM_LEDS 5
  5. //define the pin which is connectet to the strip
  6. #define DATA_PIN 6
  7. //define our led array
  8. CRGB leds[NUM_LEDS];
  9.  
  10. void setup() {
  11. // define strip type
  12. delay(2000);
  13. FastLED.addLeds<WS2812B, DATA_PIN, BRG>(leds, NUM_LEDS);
  14.  
  15. }
  16.  
  17. void loop() {
  18. // set all leds to red
  19. leds[0] = CRGB::Red;
  20. leds[1] = CRGB::Red;
  21. leds[2] = CRGB::Red;
  22. leds[3] = CRGB::Red;
  23. leds[4] = CRGB::Red;
  24. FastLED.show();
  25.  
  26. // change brightness from 30 up to 255
  27. for(int j=30;j<256;j++)
  28. {
  29. FastLED.setBrightness(j);
  30. FastLED.show();
  31.  
  32. delay(10);
  33. }
  34. // change brightness from 255 down to 30
  35. for(int j=255;j>30;j--)
  36. {
  37. FastLED.setBrightness(j);
  38. FastLED.show();
  39.  
  40. delay(10);
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment