NeoSegmentBus.ino 988 B

123456789101112131415161718192021222324252627282930313233343536
  1. // NeoSegmentBus
  2. // This example will demonstrate using the NeoSegmentBus which provides support for a
  3. // seven segment LED digit driven by three WS2811; connected in series with other digits
  4. //
  5. // See https://shop.idlehandsdev.com/products/addressable-7-segment-display for a hardware example
  6. //
  7. // This example will print the string "3.14" and then rotate it through the available digits
  8. //
  9. #include <NeoPixelSegmentBus.h>
  10. const uint16_t DigitCount = 4; // Max Digits, not segments, not pixels
  11. const uint8_t BusPin = 2; // make sure to set this to the correct pin, ignored for Esp8266
  12. #define brightness 128
  13. NeoPixelSegmentBus<SevenSegmentFeature, NeoWs2811Method> strip(DigitCount, BusPin);
  14. void setup()
  15. {
  16. strip.Begin();
  17. strip.Show(); // clears all digits by default
  18. delay(500);
  19. strip.SetString(0, "3.14", brightness);
  20. strip.Show();
  21. }
  22. void loop()
  23. {
  24. delay(2000);
  25. strip.RotateRight(1); // reads right to left, so it is reversed
  26. strip.Show();
  27. }