Home

Awesome

Arduino CI Arduino-lint JSON check GitHub issues

License: MIT GitHub release PlatformIO Registry

HT16K33

Arduino Library for HT16K33 I2C 4x7segment display.

Description

This library is for the Adafruit 4x7segment display with HT16K33 driver, http://www.adafruit.com/products/1002

This library is functionally less capable than Adafruits. However as it caches the values written to the display per position it is faster for writing on average. The actual gain depends on the application and of course the values.

0.4.0 Breaking change

Version 0.4.0 introduced a breaking change. You cannot set the pins in begin() any more. This reduces the dependency of processor dependent Wire implementations. The user has to call Wire.begin() and can optionally set the Wire pins before calling begin().

Performance

Version 0.3.0 allows one to switch the caching on/off to enforce writing all positions e.g. in case of noisy I2C bus.

The example demo_cache.ino measures the performance gain of caching for different I2C bus speeds.

Test on UNO, I2C.setClock(100000);  // version 0.1.2
0-9999 integers       3.960 sec
0-65535 hexadecimal  23.685 sec

Test on UNO, I2C.setClock(800000);  // version 0.1.2
0-9999 integers       1.223 sec
0-65535 hexadecimal   6.350 sec

Test on UNO, I2C.setClock(100000);  // version 0.3.0
0-9999 integers       4.092 sec     // ~3% slower due to robustness & cache control 
0-65535 hexadecimal  24.336 sec

Multiple display

The library supports only one display. Using multiple displays (cascading) e.g. to display more than 4 digits must done by the user - see demo_dual1.ino. With dual display it is important to setDigits() for the displays correctly to get leading/trailing zero's correctly.

Interface

#include "HT16K33.h"

Setup behaviour

Cache

Display

Data types

The bool return value indicates that the value displayed is in range.

Fixed point

Special VU meters

Lower level workers

When using the consts SEG_A etc from .h file, for the displayRaw() one can use the individual segments SEG_A..SEG_G and SEG_DP.

layout.

Image courtesey wikimedia

Extra LEDs table

maskdescription
0x00all off
0x02colon.
0x04upper left point, left of the 1st digit.
0x08lower left point, left of the 1st digit.
0x10upper point between 3rd and 4th digit.

( based upon issue #21 )

Debugging

Obsolete soon

Characters supported

from .h file, elaborate

#define HT16K33_0                0
#define HT16K33_1                1
#define HT16K33_2                2
#define HT16K33_3                3
#define HT16K33_4                4
#define HT16K33_5                5
#define HT16K33_6                6
#define HT16K33_7                7
#define HT16K33_8                8
#define HT16K33_9                9
#define HT16K33_A                10
#define HT16K33_B                11
#define HT16K33_C                12
#define HT16K33_D                13
#define HT16K33_E                14
#define HT16K33_F                15
#define HT16K33_SPACE            16
#define HT16K33_MINUS            17
#define HT16K33_TOP_C            18     //  c
#define HT16K33_DEGREE           19     //  °
#define HT16K33_NONE             99

If other chars are needed please file an issue.

Operation

See examples

Future

Must

Mainly for a 0.4.x

Should

Could

Wont (unless sponsored)

Support

If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.

Thank you,