Testing the Clock

It's not just the time we need to display. We want to show a decimal point on the right hand side if the alarm is turned on. We need to display something when there is no WiFi and therefore no internet radio.

The 4 Digit, 7 Segment LED display uses the I2C interface and by default is on address 0x70. The IOT.Device.Bindings library can drive the I2C devices. The display with it's backpack I am using has a HT16K33 chip and the library has a Large4Digit7SegmentDisplay class which can drive the display, but it does not drive the decimal points. After some time debugging the code, I tracked it down to Large4Digit7SegmentDisplay.Write method was filtering out all bit values over 6,  bit 7 being the decimal point). I took a copy of the code for Large4Digit7SegmentDisplay class and updated it and that code now works and allows the driving of each LED segment, decimal points and the centre colon. See my Git repo for the actual code.

Driving the display is simple enough. You fill an array of bytes with values, each bit of each value controls which segment of the digit gets displayed. Bit 1 is the top bar, Bit 2 is the right top bar, etc. Once you have your array of bytes, you write the array to the device over I2C. There are also options to make the display flash and control the brightness as well - All controlled by the data in the buffer.

Next time I will look at the touch sensor.

(C) P J Tewkesbury 2024 - 2023.11.23.1 - All Rights Reserved - Forgot Password
Powered by .NET 7.0.14 and running on serverpi with Unix 6.1.21.8 - Deployed from commit cb263ce4