spacepaste

  1.  
  2. #include <util/delay.h>
  3. #include <avr/io.h>
  4. #include <avr/interrupt.h>
  5. #include "light_ws2812.h"
  6. #define NUM_LEDS 60
  7. struct cRGB leds[NUM_LEDS];
  8. int main(void)
  9. {
  10. int position = 0;
  11. while(1) {
  12. // Let one light run from first to last LED
  13. if (position == 59) {
  14. position = 0;
  15. }
  16. leds[position].r = 255;
  17. leds[position].g = 0;
  18. leds[position].b = 0;
  19. leds[position-1].r = 0;
  20. leds[position-1].g = 0;
  21. leds[position-1].b = 0;
  22. position++;
  23. _delay_ms(10);
  24. }
  25. }
  26.