import time
for i in range(3):
print("1")
time.sleep(1)
for i in range(3):
print("2")
time.sleep(1) 输出为
import _thread
import time
import sys
import machine
def test1(*args, **kwargs):
for i in range(3):
print("1")
time.sleep(1)
def test2(*args, **kwargs):
for i in range(3):
print("2")
time.sleep(1)
# 此处创建2个线程
thread_1 = _thread.start_new_thread(test1, (1,))
thread_2 = _thread.start_new_thread(test2, (2,)) 说明:_thread.start_new_thread
import _thread
import time
import sys
import machine
# ---------- 这是一个线程要执行的代码 ------------
def test1(*args, **kwargs):
while True:
print("1")
time.sleep(1)
# ---------- 这是另一个线程要执行的代码 ------------
def test2(*args, **kwargs):
while True:
print("2")
time.sleep(1)
# ---------- 这里创建线程 ------------
thread_1 = _thread.start_new_thread(test1, (1,))
thread_2 = _thread.start_new_thread(test2, (2,))
# ---------- 这是主线程要执行的代码 ------------
while True:
print("3")
time.sleep(1)
I2S(Inter—IC Sound)总线, 又称集成电路内置音频总线,是飞利浦公司为数字音频设备之间的音频数据传输而制定的一种总线标准。
本小节讲解模拟量传感器使用,旋转电位器,DHT11温湿度传感器和实现自定义传感器类。
本小节讲解Sensor类及派生类、数字量传感器使用和传感器的推荐交互流程。
本小节讲解ESP32内置触摸引脚的用法,
本小节主要介绍按键信号转换、Button类及派生类、和Button交互推荐流程。
本小节主要介绍Ws2812灯珠的使用、对父类进行扩展实现自定义功能,和指针向下强制转换的使用。
本小节主要介绍RGB三色LED的使用,以及多态的具体实现。
ESP32 Arduino Framework是专门针对ESP32开发板的Arduino应用开发框架,为用户开发IOT应用、HMI应用提供一致的开发体验。
ESPConnect是一个基于现代浏览器的管理器,在你需要快速验证、调试、管理文件、检查状态的时候,它能帮你省下大量打开和切换重型工具的时间。
本文介绍两种使用TEA5767收音机模块实现FM收音机的方案,感兴趣的朋友可在此基础上实现更丰富的功能。
GPIOViewer 是一个强大的 Arduino 库,专门为 ESP32 芯片设计,可以实时监控 ESP32 芯片上的所有 GPIO 引脚状态。它可以帮助你快速直观地了解每个引脚的当前状态,例如高电平、低电平、输入、输出、中断等等。