smittytone / ht16k33-python Goto Github PK
View Code? Open in Web Editor NEWCombination Micropython and Circuitpython drivers for various HT16K33-based LEDs
Home Page: https://smittytone.net/docs/ht16k33.html
License: MIT License
Combination Micropython and Circuitpython drivers for various HT16K33-based LEDs
Home Page: https://smittytone.net/docs/ht16k33.html
License: MIT License
I was looking through the code for the 7 segment portion. I noticed that the library is setup for a 4 digit display with a colon. Is there a version that will allow the use of (8) 7-segment displays with no colon? I want to use the HT16K33 to be able to drive (8) 7-segs to be able to display a value of 0-99,999,999 (ignore the commas).
Could you please add support for 0.54" Adafruit 14-digit HT16K33 LED backpack? It uses different addressing scheme incompatible with ht16k33segment14.py.
It is described in python code at https://www.smythe-consulting.com/2017/04/driving-adafruit-4x14-segment-i2c.html. Thanks.
Hi. Thanks for putting this together. I'm trying to get this running in MicroPython (latest build) for use on an older Adafruit Bi-color 8x8 matrix with a Pico W and I'm getting errors. I've used CircuitPython to test the matrix and it works fine. I copied the code and created the 2 libraries and saved those to my \lib folder on the Pico. Trying to get your example.py program to run using your i2c line (scl=Pin(9)) but get this set of errors :
Traceback (most recent call last):
File " ", line 18, in
File "/lib/ht16k33matrixcolour.py", line 135, in _init
File "/lib/ht16k33.py", line 36, in _init
File "/lib/ht16k33.py", line 95, in power_on
File "/lib/ht16k33.py", line 120, in write_cmd
OSError: [Errno 5] EIO
Appreciate any guidance. Thanks.
Hi,
Trying to use your library on pico pi micropython:
MicroPython v1.21.0, picow v1.21.0 on 2023-10-06; Raspberry Pi Pico W with RP2040
via .mpy files (the installation via mip failed - OSError -6) but upon running example code I'm getting the error:
Traceback (most recent call last): File "<stdin>", line 4, in <module> ValueError: incompatible .mpy file
The .mpy files are where they should be I guess (using MicroPico VS Code extension):
Any clues of what might be the problem here ?
Thanks !
Would it be possible to add support for 180 degree rotation (defined at object instantiation)
I think I saw that there is a scheme for connecting multiple devices together in an array, for example to display 8 character on 7-seg. Is the 'rotate()' setting on each display, or on the whole array (together as one)?
The reason I'm asking is that 1.2inch display is NOT rotational symmetrical:
https://smittytone.net/docs/ht16k33_segmentbig.html
And for my project (https://github.com/mungewell/pico-timecode) I am considering using these for a 'Digi-Slate'. One thing that is done is 'tail slating', where the slate is 'clapped' at the end of a segment - to signify this the slate is inverted....
Most of the time the TimeCode will contain characters which would define which way up the 'display' is, for example no question with "13:13:13:13" but others are ambiguous (ie "2", "5", "6" and "9"s). If I was to place the two display with the two 'joining colons' together, I could light one or the other to signify which way the display is the the :SS:FF
value (vs HH:MM
).
Just a thought, and you're welcome to say "won't implement". Thank you for the library anyhow.
Hello Tony,
First let me thank you for sharing the drivers of HT16K33 display for use with MicroPython.
So here is my issue.
I am using the 4 character, 14Segment display (with a decimal point) from a RPi-Pico-W connected to Rpi5 using Thonny.
I am also using the same display with MicroBit V1 connected to a Windows Laptop using Make Code App.
It is an I2C display.
Using the Block Based code from MakeCode (or JavaScript) . To use the display, I have to load an extension in MakeCode (akin to loading the drivers for HT16K33 in microPython) by TinkerCademy (screen shot attached)
The block code is:
The resulting JS code is:
So the display shows "1234" and "ABCD" as expected.
However, when I use the same display on Pico-W using your driver, the display shows
"CDAB" or "3412" but the print_chars() function shows "ABCD" on the REPL output.
Here your example code modified to show this issue:
`# IMPORTS
import utime as time
from machine import I2C, Pin, RTC
from ht16k33 import HT16K33Segment14
DELAY = 0.01
PAUSE = 3
def print_chars():
global a
print (chr(a), chr(a+1), chr(a+2), chr(a+3))
if name == 'main':
# Configured for the Raspberry Pi Pico -- update for your own setup
i2c = I2C(0, scl=Pin(9), sda=Pin(8))
display = HT16K33Segment14(i2c, is_ht16k33=True)
display.set_brightness(2)
display.clear()
a = 65
display.set_character(chr(a), 0, False )
display.set_character(chr(a + 1), 1, False )
display.set_character(chr(a + 2), 2, False )
display.set_character(chr(a + 3), 3, False )
print_chars()
display.draw()
`
I have no idea what's causing this and why.
The MakeCode drivers/extension is not from the Manufacturer of the display. So, it is kind of a third party driver.
Thanks and kind regards,
'''
>>> display.set_blink_rate(0.5)
Traceback (most recent call last):
File "", line 1, in
File "/lib/ht16k33.py", line 49, in set_blink_rate
TypeError: unsupported types for and: 'float', 'int'
'''
Writing a space to the segment using led.set_character(" ")
displays 0
in the first digit.
Example code
display = HT16K33Segment(I2C(0, sda=Pin(16), scl=Pin(17)))
display.clear().draw()
for digit in range(4):
display.set_character(" ", digit)
display.draw()
I believe this bug is due to the " "
using the HT16K33_SEGMENT_SPACE_CHAR
value 0x00
for char_val
in set_character
HT16K33-Python/ht16k33segment.py
Line 151 in a441e48
which is then used as an index into CHARSET
HT16K33-Python/ht16k33segment.py
Line 160 in a441e48
whose first value (index 0x00
) is 0x3F
, representing the 0
character (LED segments 0-5)
HT16K33-Python/ht16k33segment.py
Line 28 in a441e48
I think a new value, \x00
, needs to be added to CHARSET
, and HT16K33_SEGMENT_SPACE_CHAR
needs to change to 0x12
. I'd be happy to make a PR if this solution seems good to you.
I have been developing a project using an ARM board similar to a Raspberry Pi (in fact, it's an Orange pi!!) but there are few (if any) usable libraries for interfacing to the ht16k33 in C-Python (or similar). Whilst the adafruit libraries and ecosystem are comprehensive, they're a bit heavyweight, and not very portable outside of their supported hardware.
Is this something you would be able to consider? It would be great to see similar functions to those exposed by eg. the Arduino library, for writing numbers directly to displays such as the 7-seg. clock, but it's possible I could port some of those myself if desired (they look pretty trivial even in C!) and potentially PR them.
I recently downloaded and am happily making use of your Python drivers for the Sparkfun 4 digit 14 segment displays but noticed that it does not presently support the centre colon illumination. (led.set_colon().draw()) does not function. Is this something that will be rectified in the future?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.