Advertisement
Guest User

Untitled

a guest
Mar 12th, 2021
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #define USE_OCTOWS2811
  2. #include <OctoWS2811.h>
  3. #include <FastLED.h>
  4.  
  5. #define NUM_LEDS_PER_STRIP 128
  6. #define NUM_STRIPS 8
  7.  
  8. CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
  9.  
  10. // Pin layouts on the teensy 3:
  11. // OctoWS2811: 2,14,7,8,6,20,21,5
  12.  
  13. void setup() {
  14. Serial.begin(115200);
  15. pinMode(13, OUTPUT);
  16. digitalWrite(13, LOW);
  17. LEDS.addLeds<OCTOWS2811>(leds, NUM_LEDS_PER_STRIP);
  18. LEDS.setBrightness(75);
  19. }
  20.  
  21. int serialGlediator() {
  22. while (!Serial.available()) {}
  23. return Serial.read();
  24. }
  25.  
  26. void loop() {
  27. while (serialGlediator() != 1) {}
  28. digitalWrite(13, HIGH);
  29. for (int i=0; i < NUM_STRIPS; i++) {
  30. for(int j=0; j < NUM_LEDS_PER_STRIP; j++) {
  31. leds[(i*NUM_LEDS_PER_STRIP) + j].r = serialGlediator();
  32. leds[(i*NUM_LEDS_PER_STRIP) + j].g = serialGlediator();
  33. leds[(i*NUM_LEDS_PER_STRIP) + j].b = serialGlediator();
  34. }
  35. }
  36. LEDS.show();
  37. digitalWrite(13, LOW);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement