Skip to content

Instantly share code, notes, and snippets.

@EspaceRaspberryFrancais
Created April 29, 2019 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EspaceRaspberryFrancais/d9a8c0fb5b96243c87aec10efe7dc333 to your computer and use it in GitHub Desktop.
Save EspaceRaspberryFrancais/d9a8c0fb5b96243c87aec10efe7dc333 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# Importation des librairies TM1637 et time
from tm1637 import TM1637
from time import sleep, localtime
# Fonction appelee a l'infini pour afficher l'heure
def afficher_horloge(aff):
# Recuperation de l'heure locale et affichage sur le module
t = localtime()
aff.numbers(t.tm_hour, t.tm_min)
print("Demarrage de l'horloge ...")
# Initialisation de l'afficheur et definition de la luminosite (0-7)
afficheur = TM1637(clk=23, dio=24)
afficheur.brightness(2)
# Boucle infinie appelant la fonction afficher_horloge()
while True:
afficher_horloge(afficheur)
# Pour soulager le Raspberry : pause de 0.5 sec
sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment