Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

61 lines
1.2KB

  1. #include <WS2812Serial.h>
  2. const int numled = 64;
  3. const int pin = 1;
  4. // Usable pins:
  5. // Teensy 3.2: 1, 5, 8, 10, 20, 31
  6. // Teensy 3.5: 1, 5, 8, 10, 20, 26, 32, 33, 48
  7. // Teensy 3.6: 1, 5, 8, 10, 20, 26, 32, 33
  8. byte drawingMemory[numled*3];
  9. DMAMEM byte displayMemory[numled*8];
  10. WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRB);
  11. #define RED 0xFF0000
  12. #define GREEN 0x00FF00
  13. #define BLUE 0x0000FF
  14. #define YELLOW 0xFFFF00
  15. #define PINK 0xFF1088
  16. #define ORANGE 0xE05800
  17. #define WHITE 0xFFFFFF
  18. // Less intense...
  19. /*
  20. #define RED 0x160000
  21. #define GREEN 0x001600
  22. #define BLUE 0x000016
  23. #define YELLOW 0x101400
  24. #define PINK 0x120009
  25. #define ORANGE 0x100400
  26. #define WHITE 0x101010
  27. */
  28. void setup() {
  29. leds.begin();
  30. }
  31. void loop() {
  32. // change all the LEDs in 1.5 seconds
  33. int microsec = 1500000 / leds.numPixels();
  34. colorWipe(RED, microsec);
  35. colorWipe(GREEN, microsec);
  36. colorWipe(BLUE, microsec);
  37. colorWipe(YELLOW, microsec);
  38. colorWipe(PINK, microsec);
  39. colorWipe(ORANGE, microsec);
  40. colorWipe(WHITE, microsec);
  41. }
  42. void colorWipe(int color, int wait) {
  43. for (int i=0; i < leds.numPixels(); i++) {
  44. leds.setPixel(i, color);
  45. leds.show();
  46. delayMicroseconds(wait);
  47. }
  48. }