ademosh

111

Dec 5th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <Adafruit_NeoPixel.h>
  2. #include <avr/power.h>
  3. #ifdef __AVR__
  4. #endif
  5.  
  6. #define PIN 6
  7. #define NUMPIXELS 24 // Popular NeoPixel ring size
  8.  
  9. Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
  10.  
  11. #define DELAYVAL 100
  12.  
  13. void setup() {
  14. #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  15. clock_prescale_set(clock_div_1);
  16. #endif
  17.  
  18. pixels.begin();
  19. }
  20.  
  21. void loop() {
  22. while (1) {
  23. pixels.show();
  24. for(int i=0; i<NUMPIXELS; i++) {
  25. pixels.setPixelColor(i, pixels.Color(255, 0, 0));
  26. pixels.show();
  27. delay(DELAYVAL);
  28. }
  29. pixels.show();
  30. for(int i=23; i<NUMPIXELS; i--) {
  31. pixels.setPixelColor(i, pixels.Color(0, 0, 255));
  32. pixels.show();
  33. delay(DELAYVAL);
  34. }
  35. }
  36. }
Add Comment
Please, Sign In to add comment