Library to create a 7-Segment Display using WS2811b addressable LEDs
Developed and tested on MicroPython ( ESP8266 and ESP32 TTGO)
For bugs and ideas of improvement feel free to open an issue!
- It is now pissible to create multiple instances of the Segment Display on different pins of the controller
- (minor bugfixes)
- Initial publish
- micropython builtin libraries
Controll a 2x2 7-Segment display with dots
import segments
display = segments.Segments(NP_PIN, addrOfset=0, ledPerSegment=3, ledPerDot=1, numDisplay=4)
NP_PIN [int]
is the pin-number the addressable LEDs are connected to
addrOffset [int]
is the address of the first led of the display (normally 0 if u have no other leds in front on the data-line)
ledPerSegment [int]
is the total count of LEDs in one single segment (default is 3 LEDs per segment)
ledPerDot [int]
is the count of LEDs in a single Dot (default is 1 LED per dot)
numDisplay [int]
is the count of single digit 7-segment-displays available for use (default is 4 displays)
There are two different ways of showing your data on the Displays:
-
By writing each single digit display on its own:
setSegment(num, value, color=(0, 0, 100))
num [int]
is the index of the digit you wanna setvalue [int/char]
the value you want the display to be set to.color [tuple (R, G, B)]
the color you want the value to be displayed (Default: 0, 0, 100 --> Blue)
-
By writing each double segment
setDoubleSegment(self, num, value, color=(0, 0, 100))
num [int]
is the index of the digit you wanna setvalue [int/char]
the value you want the display to be set to. 1color [tuple (R, G, B)]
the color you want the value to be displayed (Default: 0, 0, 100 --> Blue) -
By switching the dots
setDots(display, dotColor=(0, 0, 100))
display [bool]
is the parameter if the dots should be on (True
) or off (False
)dotColor [tuple (R, G, B)]
is the color the dot schould be displayed
List of available Symbols:
- Digits
0 - 9
- Degree Symbol
°
- Letters
C, F, E, U, P
- Minus
-
Footnotes
-
setDoubleSegments()
only accepts values from 0 up to 99 ↩