# Display5a.py from TM1637 import FourDigit from time import sleep d = FourDigit() d.erase() sleep(2) d.show("0123") sleep(3) d.setColon(True) d.show("ABCD") sleep(3) d.setColon(False) d.setLuminosity(7) # range 0..7 d.show("donE")
# Display5f.py # Return value from toRight from TM1637 import FourDigit from time import sleep d = FourDigit() d.show("0123456789") sleep(2) nb = 1 while nb > 0: nb = d.toRight() print(nb) sleep(1) d.show("donE")
# This uses the GPIO BOARD PINS (1 thru 40) d = [] d.append(config.getint('CLOCK', 'DIO1')) d.append(config.getint('CLOCK', 'DIO2')) d.append(config.getint('CLOCK', 'DIO3')) d.append(config.getint('CLOCK', 'DIO4')) c = [] c.append(config.getint('CLOCK', 'CLK1')) c.append(config.getint('CLOCK', 'CLK2')) c.append(config.getint('CLOCK', 'CLK3')) c.append(config.getint('CLOCK', 'CLK4')) disp = [] for x in range(0,NUM_MODS): disp.append(FourDigit(dio=d[x],clk=c[x],lum=l)) showColon = True if DEBUG: print("Number of modules = "+str(NUM_MODS)) if DEBUG: print("Starting clock loop...") # DISPLAY TIME ON ONE MODULE def displayTM(disp,tim,hrs,colon): if DEBUG: print("displayTM()") hour = tim.tm_hour
# Display5g.py # Example scrolling text from TM1637 import FourDigit from time import sleep d = FourDigit() d.show("HELLo PYthon") sleep(1) while True: nb = 1 while nb > 0: nb = d.toLeft() sleep(0.5) sleep(1) d.toStart() sleep(1)
# # Test a TM1637 4 digit iDisplay Module # usage: # Wire TM1637 # 5V -- Pin 2 on Pi # GND-- Pin 6 # CLK-- Pin 40 # DIO-- Pin 38 # # $ python test.py # # If needed, edit FourDigit() to change pins # from TM1637 import FourDigit from time import sleep d = FourDigit(dio=38, clk=40, lum=1) d.erase() sleep(2) d.show("0123") sleep(3) d.setColon(True) d.show("ABCD") sleep(3) d.setColon(False) d.setLuminosity(4) # range 0..7 d.show("donE") sleep(3) d.erase()
# Display5h.py # scroll from TM1637 import FourDigit from time import sleep d = FourDigit() while True: d.scroll("HELLo PYthon")
import os import time from TM1637 import FourDigit import datetime d = FourDigit(dio=38,clk=40,lum=1) currentDT = datetime.datetime.now() d.show (currentDT.hour,currentDT.minute) d.erase()
try: ta_temp = round(ds.read(True, DS_DPIN, DS_ID), 1) _log.info('Očitana temperatura sa DS senzora: {}°C'.format(ta_temp)) if ta_temp is not None: blynk.virtual_write(DS_VPIN, ta_temp) if ta_temp <= temperature: sendNotification('TA peć je prazna, uključite akumulaciju') except: _log.error('Došlo je do greške prilikom čitanja DS senzora') blynk.virtual_write(DS_VPIN, 0) ######################## # Display functions # ######################## dis = FourDigit() display_counter = 0 displayenabled = params['displayenabled'] humidity, temperature = Adafruit_DHT.read_retry(11, TEMP_DPIN) def display_date(): dis.setColon(False) dis.show(datetime.now().strftime('%d%m')) def display_time(): dis.setColon(True) dis.show(datetime.now().strftime('%H%M'))
# Display5i.py # count from TM1637 import FourDigit d = FourDigit() while True: for n in range(10000): d.show(n)
# Display5c.py # Scroll left from TM1637 import FourDigit from time import sleep d = FourDigit() d.show("0123456789") sleep(2) for i in range(10): d.toLeft() sleep(1) d.show("donE")
# Display5b.py # Shift from TM1637 import FourDigit from time import sleep d = FourDigit() d.show("0123") sleep(2) d.show("0123", 2) sleep(2) d.show("0123", -2) sleep(2) d.show("donE")