How to realize Digital Tube display with python
This article mainly introduces "how to achieve digital tube display in python". In daily operation, I believe many people have doubts about how to achieve digital tube display in python. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to achieve digital tube display in python". Next, please follow the editor to study!
Import pybfrom pyb import Pin # the development board pin corresponding to the digital tube axig dp dpins = [pin (iMagne Pin.OUTRAPP) for i in] number= {'0Q] number= {'0rec]: [0re0pins = [pin (iMin Pin.OUTRAPP) for i in] corresponding to the digital tube segment 1234. ], # 0prime1], # 0prime1: [1rector1, # 0meme1], # 1meme2: [0meme0pyrrino 1], # 1yuan2: [0pyrrine 0pyrrhen1], # 2yuan3: [0pt0re1], # 3Phone4: [1pr 0pr 1], # 4thanks 5 minutes: [0rec 1, 0pr, 1], # 5 "6": [0rec 1, 0, 0, 0, 0, 0, 0, 0, and 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0 def display 1], # 8 million 9 minutes: [0 recollection 0 recorder 0 recorder 1], # 9} num Dp): global number count=0 for pin in d_Pins:# displays the value of num pin.value (number [num] [count]) count+=1 if dp==1: d_Pins [7] .value (0) def clear (): for i in w_Pins: i.value (0) for i in d_Pins: i.value (1) def showData (num): # split the hundreds, thousands, The value of individual and decimal places d_num=num location=d_num.find ('.') If location > 0: d_num=d_num.replace ('.',') while len (d_num)