The Ht16k33 is a multi-function LED controller driver. It is used as a backpack driver for several Adafruit products. It uses the I2C protocol.
This binding and samples are based on adafruit/Adafruit_CircuitPython_HT16K33.
These bright crisp displays are good for showing numeric output. Besides the four 7-segments there is a top right dot (perhaps useful as a degrees symbol) and two sets of colon-dots (good for time-based projects). They come in several colors.
You can write the following code to control them or checkout a larger sample.
// Initialize display (busId = 1 for Raspberry Pi 2 & 3)
using var display = new Large4Digit7SegmentDisplay(I2cDevice.Create(new I2cConnectionSettings(busId: 1, address: Ht16k33.DefaultI2cAddress));
// Set max brightness (automatically turns on display)
display.Brightness = display.MaxBrightness;
// Write time to the display
display.Write(DateTime.Now.ToString("H:mm").PadLeft(5));
// Wait 5 seconds
Thread.Sleep(5000);
// Turn on buffering
display.BufferingEnabled = true;
// Write -42°C to display using "decimal point" between 3rd and 4th digit as the ° character
display.Write("-42C");
display.Dots = Dot.DecimalPoint;
// Send buffer to the device
display.Flush();
This display is good for showing alpha-numeric output, and its additional segments provide a wider range of characters
Checkout a sample.
Make a scrolling sign or a small video display with 16x8, 8x8, and Bicolor LED matrices. They are quite visible but not so large it won't plug into a breadboard!
You can write the following code to control them or checkout a larger sample (Bicolor sample).
using Matrix8x8 matrix = new(I2cDevice.Create(new I2cConnectionSettings(busId: 1, Ht16k33.DefaultI2cAddress)))
{
// Set max brightness
Brightness = Ht16k33.MaxBrightness,
BufferingEnabled = true
};
matrix.Clear();
// Set pixel in the top left
matrix[0, 0] = 1;
// Set pixel in the middle
matrix[3, 4] = 1;
matrix[4, 3] = 1;
// Set pixel in the bottom right
matrix[7, 7] = 1;
Make a small linear display with multiple colors using this elegant bi-color LED bargraph. Every bar has two LEDs inside so you can have it display red, green, yellow or with fast multiplexing (provided by the HT16K33 driver chip) any color in between.
You can write the following code to control them or checkout a larger sample.
using BiColorBarGraph bargraph = new(I2cDevice.Create(new I2cConnectionSettings(busId: 1, Ht16k33.DefaultI2cAddress)))
{
// Set max brightness
Brightness = Ht16k33.MaxBrightness,
BufferingEnabled = true
};
bargraph.Clear();
bargraph[0] = LedColor.RED;
bargraph[1] = LedColor.GREEN;
bargraph[2] = LedColor.YELLOW;
bargraph[3] = LedColor.OFF;
bargraph[4] = LedColor.RED;