# coding=utf-8 from time import sleep from rpi_TM1638 import TMBoards # my GPIO settings (two TM1638 boards connected on GPIO19 and GPIO13 for DataIO and Clock; and on GPIO06 and GPIO26 for the STB) DIO = 19 CLK = 13 STB = 26 #STB = 6, 26 # instanciante my TMboards TM = TMBoards(DIO, CLK, STB, 0) TM.clearDisplay() # some LEDs manipulation TM.leds[0] = True # turn on led 0 (1st led of the 1st board) TM.leds[ 5] = False # turn off led 5 (5th led of the 2nd board, since there is 8 leds per board) TM.leds[ 12] = True # turn on led 12 (5th led of the 2nd board, since there is 8 leds per board) TM.segments[ 1] = '0' # display '0' on the display 1 (2nd 7-segment display of the 1st board) TM.segments[ 4] = '98.76' # display '9876' on the 7-segment display number 4, 5, 6 and 7 (the point is on segment 5) TM.segments[3, 1] = True # turn on the segment #1 of the 7-segment number 3 TM.segments[8] = '01234567' TM.leds = (True, False, True) # set the three first leds
from rpi_TM1638 import TMBoards from time import sleep DIO = 19 CLK = 13 STB = 26 TM = TMBoards(DIO, CLK, STB, 0) TM.clearDisplay() s = int( input("Ingresa sengudos para el temporizador: ") ) #solicitd al usuario por condiciones de prueba no se puede ingresar nuermos mayores a 2 m = int(input("Ingresa minutos para el temporizador: ")) h = int(input("Ingresa horas para el temporizador: ")) while True: if h == 0 and m < 0 and s == 2: #condcion de salida h = 0 m = 0 s = 0 TM.segments[0] = '00' #despligue de termino TM.segments[2] = '.' TM.segments[3] = '00' TM.segments[5] = '.' TM.segments[6] = '00' break TM.segments[0] = '{:2d}'.format(abs(h)) #formato de despliegue TM.segments[2] = '.' TM.segments[3] = '{:2d}'.format(abs(m)) TM.segments[5] = '.' TM.segments[6] = '{:2d}'.format(abs(s)) s -= 1