Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to illuminate the heart-shaped 8x8 lattice by Micropython

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to light the heart-shaped 8x8 lattice by Micropython". The editor shows you the operation process through the actual case, the operation method is simple and fast, and the practicality is strong. I hope this "how to light the heart-shaped 8x8lattice" article can help you solve the problem.

1. Experimental purpose

1. Learn the method of extending the simple Iripple O interface in the PC system.

two。 Further learn the design method of compiling data output program.

3. Learn the connection method between the 8x8 lattice and TPYBoard, and light up the lattice.

two。 Required components

8: 8 dot matrix

TPYBoard board

A data line

Some DuPont lines

3. Light up the 8*8LED lattice

There are two rows of pins behind the lattice, one begins with 1, that is, 1-8 pins, and the other begins with 9, that is, 9-16 pins. The number of ⑨? ⑧? ①⑦②⑤ in the picture above corresponds to the corresponding number of pins. When ROW's ⑨? ⑧? ①⑦②⑤ is high, COL PIN NO. When the power level is low, our LED is all lit up. In order to facilitate the operation of rows and columns, we can connect the 8 pins of ROW to the 8 pins of our TPYBoard X1MurX8 Col to our TPYBoard Y1-Y8, so that we can control which pin is lit and off. It is no problem to display any characters. Come and try it.

4. Control 8-8 lattice

After we have followed the above steps, we can turn on the power and write the main.py file to display the characters or patterns you want to display. The following code shows the heart-shaped pattern on the 8x8 dot matrix. The specific code is as follows:

# main.py-- put your code hereafter recording import pybfrom pyb import Pinx_PIN = [Pin (I, Pin.OUT_PP) for i in ['X1ZHZ] X2BZ [' X4BZ] X5BZ]] y_PIN = [Pin (I, Pin.OUT_PP) for i in ['Y1BZ] for i in [' Y2MYZ]] hanzi= ['11111111111111'] '10001000',''10000000',' '10000000',' '10000000',' '11000001',' 11100011' '11110111'] def displayLED (): flag=0 for x _ in range (0penalty 8): for b in range (0score8): print (b) if bounded flag: XPIN [b] .value (0) li_l = hanzi [x _] y_PIN [0] .value (int (li_l [: 1])) y_PIN [1 ] .value (int (li_ l [1: 2]) y_PIN [2] .value (int (li_ l [2: 3]) y_PIN [3] .value (int (li_ l [3: 4])) y_PIN [4] .value (int (li_ l [4: 5])) y_PIN [5] .value (int (li_ l [5: 6])) Y_PIN [6] .value (int (li_ l [6: 7])) y_PIN [7] .value (int (li_ l [7: 8])) x _ pin [flag] .value (1) flag=flag+1 pyb.delay (2) while 1: displayLED () about "how Micropython lights up the heart-shaped 8x8 lattice" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report