Example #1
0
DIO = 19
CLK = 13
#STB = 06, 26
STB = 6

# 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[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

#
while True:
    a = TM.getData(0)
    # 	b=TM.getData(1)
    TM.segments[0] = ''.join("%02d" % x for x in a)
    # 	TM.segments[8] = ''.join("%02d" % x for x in b)
    sleep(0.01)
Example #2
0
			waitLcd(1)

	# Mod
	if (os.path.getctime(configGet('domo', 'jsonFile', 'modPath')) > lastRefreshMod): 
		logMsg(5, "Fichier mod modifié")
		lastRefreshMod=t
		if (lastHashMod != hashlib.md5(file_as_bytes(open(configGet('domo', 'jsonFile', 'modPath'), 'rb'))).hexdigest()):
			logMsg(4, "Fichier mod est différent (hash md5)")
			with open(configGet('domo', 'jsonFile', 'modPath')) as f4:
				JsonModRelay = json.load(f4)
			lastRefreshMod = refreshMod(JsonModRelay) 
			lastHashMod = hashlib.md5(file_as_bytes(open(configGet('domo', 'jsonFile', 'modPath'), 'rb'))).hexdigest()
			waitLcd(1)

	# Gestion boutton (en attente de la lib ?)
	bouttonArray =TM.getData(0)
	idButton=0
	for etatBoutton in bouttonArray:
		if (etatBoutton != 0):
			if (etatBoutton == 16):
				idButtonReal=idButton+4+1
			else:
				idButtonReal=idButton+1
			# Etat Suivant : 
			modNow=JsonModRelay[str(idButtonReal)]
			if modNow == 0:
				modNext=1
			elif modNow == 3:
				modNext=0
			else:
				modNext=3