| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
python-tm1637 is a library for interfacing with TM1637-based 4-digit 7-segment LED display modules, using the Linux GPIO character device interface (gpiod).
pip install python-tm1637import time
import tm1637
# Initialize display connected to GPIO 23 & 24 at /dev/gpiochip4
display = tm1637.TM1637(clk=23, dio=24, chip_path="/dev/gpiochip4")
# Write segments directly
display.write([127, 127, 127, 127]) # 8888
time.sleep(1)
# Turn off all LEDs
display.write([0, 0, 0, 0])
time.sleep(1)
# Display text
display.show("HIYA")
time.sleep(1)
# Display a number
display.number(8888)
time.sleep(1)TM1637(clk, dio, *, chip_path="/dev/gpiochip*", brightness=7)Extends the TM1637 class to enable support for display modules having a decimal point after each digit.
To access the GPIO chip device without root permissions, the user must be in the gpio group. To add the current user to the gpio group:
sudo usermod -aG gpio $USER
sudo reboot| TM1637 | Pin |
|---|---|
| CLK | GPIO X |
| DIO | GPIO Y |
| VCC | 3.3V or 5V |
| GND | Ground |
where TM1637(clk=X, dio=Y)
import time
import tm1637
display = tm1637.TM1637(clk=23, dio=24)
colon = True
while True:
time.sleep(1 - time.time()%1)
lt = time.localtime()
display.numbers(lt.tm_hour, lt.tm_min, sep=colon)
colon = not colonimport tm1637
display = tm1637.TM1637(clk=23, dio=24)
display.temperature(23) # 23*C
display.temperature_decimal(23.5) # 23:5*import tm1637
display = tm1637.TM1637(clk=23, dio=24)
display.scroll("HELLO WORLD", delay=0.1)| Back | FazBrowse Home | New Git URL |