(四)MicroPython——点阵屏
2023-02-18 16:23:34 时间
目录
学习目标
本节来学习有关点阵屏的知识,在51都介绍过,所以在此不再赘述,但是因为没有找到点阵屏的开发手册和接线原因,实验显示不是很明显。
成果展示
硬件知识
(八)51单片机基础——LED点阵屏_花园宝宝小点点的博客-CSDN博客_led点阵显示屏编程
https://blog.csdn.net/weixin_66578482/article/details/125035136
代码
import machine
import time
row_1 = machine.Pin(32, machine.Pin.OUT)
row_2 = machine.Pin(33, machine.Pin.OUT)
row_3 = machine.Pin(25, machine.Pin.OUT)
row_4 = machine.Pin(26, machine.Pin.OUT)
row_5 = machine.Pin(27, machine.Pin.OUT)
row_6 = machine.Pin(14, machine.Pin.OUT)
row_7 = machine.Pin(12, machine.Pin.OUT)
row_8 = machine.Pin(13, machine.Pin.OUT)
row_list = [row_1, row_2, row_3, row_4, row_5, row_6, row_7, row_8]
col_1 = machine.Pin(19, machine.Pin.OUT)
col_2 = machine.Pin(18, machine.Pin.OUT)
col_3 = machine.Pin(5, machine.Pin.OUT)
col_4 = machine.Pin(17, machine.Pin.OUT)
col_5 = machine.Pin(16, machine.Pin.OUT)
col_6 = machine.Pin(4, machine.Pin.OUT)
col_7 = machine.Pin(2, machine.Pin.OUT)
col_8 = machine.Pin(15, machine.Pin.OUT)
col_list = [col_1, col_2, col_3, col_4, col_5, col_6, col_7, col_8]
def set_power_row(i):
for row in row_list:
row.value(0)
if 0 <= i <= 7:
row_list[i].value(1)
def set_earth_col(i):
for col in col_list:
col.value(1)
if 0 <= i <= 7:
col_list[i].value(0)
def show_liushuideng():
# 流水灯
for row in range(8):
set_power_row(row)
for col in range(8):
set_earth_col(col)
time.sleep_ms(100)
def show_arrow():
# 箭头图形
img_list = [
(1, 4),
(2, 5),
(3, 6),
(4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (4, 7),
(5, 6),
(6, 5),
(7, 4)
]
# 让箭头从左向右移动
while True:
for i in range(-7, 8):
for j in range(5):
for x, y in img_list:
set_power_row(x)
set_earth_col(y + i)
time.sleep_ms(1)
if __name__ == "__main__":
show_liushuideng()
show_arrow()
总结
接线好烦
相关文章
- 【图文教程】腾讯云安装python3
- Python学习:内建属性、内建函数的教程
- [oeasy]python0030_设置路径_export_PATH_zsh_系统路径设置_export
- Python从0到1丨细说图像增强及运算
- Python图像处理丨详解图像去雾处理方法
- 盘点Python 中字符串的常用操作
- 从0到1学Python丨图像平滑方法的两种非线性滤波:中值滤波、双边滤波
- 跟我学Python图像处理丨带你入门OpenGL
- 跟我学Python图像处理丨图像分类原理与案例
- Python 中 Pickle 库的使用详解
- Python: PyQt5在Pycharm中的配置
- Python: 按位或运算符(Bitwise OR)
- 不知道"鸭子类型"就当没学过python
- 盘一盘 Python 特别篇 23 - 爱因斯坦求和 einsum
- Python中的一个神秘文件:__init__.py 使用讲解
- 孤陋寡闻了,Python中类竟可以像列表一样操作
- Python表白C#?文末有彩蛋!
- (数据科学学习手札147)Python GIS利器shapely全新2.0版本一览
- Python 大数据量文本文件高效解析方案代码实现
- Python3.11正式版,它来了!