PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2KB

  1. // Glediator example with OctoWS2811, by mortonkopf
  2. //
  3. // https://forum.pjrc.com/threads/33012-Gladiator-with-OctoWS2811-working-example
  4. // You can also use Jinx to record Glediator format data to a SD card.
  5. // To play the data from your SD card, use this modified program:
  6. // https://forum.pjrc.com/threads/46229&viewfull=1#post153927
  7. #include <OctoWS2811.h>
  8. const int ledsPerStrip = 34;
  9. const int NUM_LEDS = 272;
  10. DMAMEM int displayMemory[ledsPerStrip*6];
  11. int drawingMemory[ledsPerStrip*6];
  12. const int config = WS2811_GRB | WS2811_800kHz;
  13. OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
  14. void setup() {
  15. leds.begin();
  16. leds.show();
  17. }
  18. int serialGlediator() {
  19. while (!Serial.available()) {}
  20. return Serial.read();
  21. }
  22. void loop() {
  23. byte r,g,b;
  24. int i;
  25. while (serialGlediator() != 1) {}
  26. for (i=0; i < NUM_LEDS; i++) {
  27. b = serialGlediator();
  28. r = serialGlediator();
  29. g = serialGlediator();
  30. leds.setPixel(i, Color(r,g,b));
  31. }
  32. leds.show();
  33. }
  34. /* Helper functions */
  35. // Create a 24 bit color value from R,G,B
  36. unsigned int Color(byte r, byte g, byte b)
  37. {
  38. return (((unsigned int)b << 16) | ((unsigned int)r << 8) | (unsigned int)g);
  39. }