树莓派Pico硬件项目:7段显示器与LCD应用
1. 7段显示器项目
1.1 2位7段显示器秒计数器
在这个项目中,使用2位7段显示器作为计数器,每秒从0计数到99。以下是相关代码:
D[i] = Pin(LED_Digits[i], Pin.OUT)
#
# Refresh the 7-segment display
#
def Refresh(timer): # Thread Refresh
global count
cnt = str(count) # into string
if len(cnt) < 2:
cnt = " " + cnt # Make sure 2 digits
for dig in range(2): # Do for 2 digits
for loop in range(0,7):
L[loop].value(LED_Bits[cnt[dig]][loop])
D[dig].value(1)
utime.sleep(0.01)
D[dig].value(0)
#
# Configure PORT to all outputs
#
Configure_Port()
#
# Main program loop. Start the periodic timer and counti
超级会员免费看
订阅专栏 解锁全文
5万+

被折叠的 条评论
为什么被折叠?



