Guest User

try-first-fastled

a guest
Nov 29th, 2023
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. // I tried the first one first, and then the second one!
  2. // They are somewhat edited, because I changed the DATA_PIN numbers a lot (started at 2),
  3. // and I also changed the colors a lot as well, number of LEDs targeted etc.
  4.  
  5. // first one!!!
  6. #include <FastLED.h>
  7. #define NUM_LEDS 60
  8. #define DATA_PIN 5
  9. #define COLOR_ORDER GRB
  10. #define CHIPSET WS2812B
  11. #define BRIGHTNESS 60
  12. #define VOLTS 5
  13. #define MAX_AMPS 500
  14.  
  15. CRGB leds[NUM_LEDS];
  16.  
  17. void setup() {
  18. FastLED.addLeds<CHIPSET,DATA_PIN,COLOR_ORDER>(leds,NUM_LEDS);
  19. FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
  20. FastLED.setBrightness(BRIGHTNESS);
  21. FastLED.clear();
  22. FastLED.show();
  23. }
  24.  
  25. void loop() {
  26. leds[0] = CRGB(255,0,0);
  27. leds[1] = CRGB(255,0,0);
  28. FastLED.show();
  29. delay(100);
  30. }
  31.  
  32. // second one!!!
  33. #include <FastLED.h>
  34. #define NUM_LEDS 7
  35. #define DATA_PIN 2
  36. // #define COLOR_ORDER GRB
  37. #define CHIPSET WS2812B
  38. #define BRIGHTNESS 60
  39. #define VOLTS 5
  40. #define MAX_AMPS 500
  41.  
  42. CRGB leds[NUM_LEDS];
  43.  
  44. void setup() {
  45. // put your setup code here, to run once:
  46. delay(2000);
  47. FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
  48. }
  49.  
  50. void loop() {
  51. leds[0] = CRGB(255,0,0);
  52. leds[1] = CRGB(0,255,0);
  53. leds[2] = CRGB(0,255,0);
  54. leds[3] = CRGB(0,0,255);
  55. leds[4] = CRGB(0,0,255);
  56. leds[5] = CRGB(0,0,255);
  57. leds[6] = CRGB(0,0,0);
  58. FastLED.show();
  59. delay(1000);
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment