from machine import UART,Pin, SoftI2C,PWM
from pn532 import Pn532
import ssd1306
import time
def clear(self):
oled.fill(0)
oled.show()
p2 = PWM(Pin(2))
p2.freq(50)
i2c = SoftI2C(scl=Pin(18),sda=Pin(19))
# 宽度高度
oled_width = 128
oled_height = 64
# 创建oled屏幕对象
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
oled.text('Welcome To Use', 10, 20)
oled.show()
time.sleep(1)
oled.text('By anopy', 30, 30)
oled.show()
time.sleep(3)
# oled预填充设定,0为纯黑,1为纯白
oled.fill(0)
# 应用填充
oled.show()
oled.text('Waiting Card...',13,30)
oled.show()
from machine import freq
from pn532 import Pn532
u1 = UART(1,115200,rx=13,tx=12)
a = Pn532(u1)
uid = a.find_card(0)
uid_str = str(uid)
uid_str = uid_str[3:8]
ad_list = [uid_str,"Z\x05"]
while True:
clear(0)
oled.text('Waiting Card...',15,30)
oled.show()
uid = a.find_card(0)
uid_str = str(uid)
u = uid_str[5:8]
if u == 'x05':
p2.duty_u16(4915)
clear(0)
oled.text('Unlocked!',30,30)
oled.show()
time.sleep(5)
p2.duty_u16(1638) # 舵机复位
time.sleep(1)
clear(0)
else:
clear(0)
oled.text('Failed!',30,20)
oled.show()
oled.text('Try again!',20,30)
oled.show()
time.sleep(3)
好家伙VCC
- 粉丝: 1954
- 资源: 9137
最新资源
- 20个单片机案例.zip、数控稳压电源、IC卡读写仿真、led大屏幕点阵屏、AVR寻迹小车、AVR寻迹小车、LC振荡器等等
- 数据分析基础知识、工具应用与实践案例
- 【源码+数据库】基于ssm框架+mysql实现的Java web在线考试系统
- 基于python + tensorflow 实现的用textcnn方法做情感分析的项目,有数据
- win10按要求设置镜像过程
- XIHE_Meteorological_Data_1730421195.csv
- 基于 python+TuShare数据存储方法及数据分析过程
- 335个单片机源码参考-2024整理.zip
- 基于opencv的人脸识别(硬件实现于esp32-cam)高分项目
- 后台运行的写日志win32程序
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈