from machine import Pin
from utime import sleep
Output_Zuordnung = [0,1,2,3,4,5,6,7,8] #Zuordnund: a-g,CLK1,CLK2
L = [0]*9
for i in range(9):
L[i] = Pin(Output_Zuordnung[i], Pin.OUT)
Output_Zustaende ={
0:(0,0,0,0,0,0,1), # 0
1:(1,0,0,1,1,1,1), # 1
2:(0,0,1,0,0,1,0), # 2
3:(0,0,0,0,1,1,0), # 3
4:(1,0,0,1,1,0,0), # 4
5:(0,1,0,0,1,0,0), # 5
6:(0,1,0,0,0,0,0), # 6
7:(0,0,0,1,1,1,1), # 7
8:(0,0,0,0,0,0,0), # 8
9:(0,0,0,0,1,0,0)} # 9
zaehler_E = 0 # Initialisiere Zähler Einerstelle
zaehler_Z = 0 # Initialisiere Zähler Zehnerstelle
while True:
# Aktuelles Segmentmuster für Einer holen
Output = Output_Zustaende[zaehler_E]
# Segmente a–g setzen
for i in range(7):
L[i].value(Output[i])
# Kurzer Puls auf CLK1
L[7].value(1)
sleep(0.01)
L[7].value(0)
# Aktuelles Segmentmuster für Zehner holen
Output = Output_Zustaende[zaehler_Z]
# Segmente a–g setzen
for i in range(7):
L[i].value(Output[i])
# Kurzer Puls auf CLK2
L[8].value(1)
sleep(0.01)
L[8].value(0)
# 1 Sekunde warten
sleep(0.2)
# Zähler erhöhen
zaehler_E += 1
# Bei 10 wieder auf 0 setzen
if zaehler_E > 9:
zaehler_E = 0
zaehler_Z += 1
if zaehler_Z > 9:
zaehler_Z = 0ERC Warnings
flop1:CLK: Clock driven by combinatorial logic
flop2:CLK: Clock driven by combinatorial logic
flop3:CLK: Clock driven by combinatorial logic
flop4:CLK: Clock driven by combinatorial logic
flop5:CLK: Clock driven by combinatorial logic
flop6:CLK: Clock driven by combinatorial logic
flop7:CLK: Clock driven by combinatorial logic
flop10:CLK: Clock driven by combinatorial logic
flop11:CLK: Clock driven by combinatorial logic
flop12:CLK: Clock driven by combinatorial logic
4 additional warning(s) hidden