GithubHelp home page GithubHelp logo

smittytone / ht16k33-python Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 5.0 374 KB

Combination Micropython and Circuitpython drivers for various HT16K33-based LEDs

Home Page: https://smittytone.net/docs/ht16k33.html

License: MIT License

Python 94.16% Shell 5.84%
adafruit circuitpython holtek ht16k33 micropython vk16k33

ht16k33-python's People

Contributors

akbiocca avatar electricimpsamplecode avatar smittytone avatar ubidefeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ht16k33-python's Issues

8 digit 7 segment display?

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).

Problem connecting Bi-color matrix to Pi Pico ...

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.

PyPi entry/adding from Thonny IDE

Package manager in Thonny does not show the package in search results making it more difficult for beginners to use/discover.
obrázok

Would it be possible to upload it to pypi in order to resolve this?

incompatible .mpy file error

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):
Screenshot 2024-01-03 at 15 02 17

Any clues of what might be the problem here ?
Thanks !

Rotation support

Would it be possible to add support for 180 degree rotation (defined at object instantiation)

Mutliple devices and 'rotate()'

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.

Characters being displayed as CDAB

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)

image

The block code is:

image

The resulting JS code is:

image

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

CONSTANTS

DELAY = 0.01
PAUSE = 3

def print_chars():
global a
print (chr(a), chr(a+1), chr(a+2), chr(a+3))

START

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,

Blink rate at 0.5 Hz is impossible to obtain.

'''
>>> 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'
'''

HT16K33Segment - writing space draws a 0

Bug

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()

Investigation

I believe this bug is due to the " " using the HT16K33_SEGMENT_SPACE_CHAR value 0x00 for char_val in set_character

char_val = self.HT16K33_SEGMENT_SPACE_CHAR

which is then used as an index into CHARSET

self.buffer[self.POS[digit]] = self.CHARSET[char_val]

whose first value (index 0x00) is 0x3F, representing the 0 character (LED segments 0-5)

CHARSET = b'\x3F\x06\x5B\x4F\x66\x6D\x7D\x07\x7F\x6F\x5F\x7C\x58\x5E\x7B\x71\x40\x63'

Possible solution

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.

Support for Cpython/etc in linux eg. Rpi boards/etc

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.

HT16K33 Python Drivers

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.