Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
MicroPython
rtt的mpy能否多个线程同时运行多个python脚本?试了貌似不行
发布于 2020-04-10 13:03:32 浏览:1119
订阅该版
我创建了两个线程,每个线程启动python脚本。一个线程时可以运行,2个的话卡住不跑了 这个是main.c里面的 #include
#include
#include
#include
#include
static void test2_run(void *p) { char py_cmd[] = "python test2.py
"; msh_exec(py_cmd, rt_strlen(py_cmd)); while(1) { // rt_kprintf("test2run
"); rt_thread_delay(RT_TICK_PER_SECOND); } } static void test1_run(void *p) { char py_cmd[] = "python test1.py
"; msh_exec(py_cmd, rt_strlen(py_cmd)); while(1) { // rt_kprintf("test1run
"); rt_thread_delay(RT_TICK_PER_SECOND/2); } } int test_thread(void) { rt_err_t ret = RT_EOK; rt_thread_t thread1 = RT_NULL; rt_thread_t thread2 = RT_NULL; /* littleGL demo gui thread */ thread2 = rt_thread_create("test2", test2_run, RT_NULL, 20480, 5, 10); thread1 = rt_thread_create("test1", test1_run, RT_NULL, 20480, 6, 10); if(thread1 == RT_NULL) { return RT_ERROR; } rt_thread_startup(thread1); if(thread2 == RT_NULL) { return RT_ERROR; } rt_thread_startup(thread2); return RT_EOK; } int main(void) { printf("hello rt-thread
"); test_thread(); return 0; } test1.py import time while(True): print("test1") time.sleep(1) test2.py import time while(True): print("test2") time.sleep(1)
查看更多
0
个回答
默认排序
按发布时间排序
暂无答案,快来添加答案吧
撰写答案
登录
注册新账号
关注者
0
被浏览
1.1k
关于作者
zhf
这家伙很懒,什么也没写!
提问
32
回答
32
被采纳
0
关注TA
发私信
相关问题
1
请问rt-thread有没有移植micropython呢
2
micropython import 文件名的方式执行脚本问题
3
第一篇:Micropython 的起源和发展
4
第二篇:RT-Thread Micropython 简介
5
第三篇:RT-Thread Micropython 快速入门
6
第四篇:Micropython DIY 项目汇总
7
第五篇:Micropython 教程和资源
8
第六篇: RT-Thread MicroPython 学习经验和学习路线
9
RT-Thread MicroPython 最新开发板固件汇总【已失效】
10
有Mpy专门的板块啦~
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
机器人操作系统 (ROS2) 和 RT-Thread 通信
4
国产MCU移植系列教程汇总,欢迎查看!
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
[RA8D1-Vision Board] sd卡实践
2
FRDM-MCXN947开发板之RGB LED驱动
3
NXP MCXN947 测评(2)基于GPIO 控制实现DHT11 温湿度采集
4
RT-Thread Vision Board - Bare Metal Project with VSCode/PyOCD/Cortex-Debug
5
【学习分享】libc切换 -- 从newlib切换到mlibc
热门标签
RT-Thread Studio
串口
LWIP
Env
SPI
Bootloader
AT
ART-Pi
Hardfault
CAN总线
FinSH
USB
文件系统
DMA
RT-Thread
SCons
线程
RT-Thread Nano
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
ota在线升级
WIZnet_W5500
I2C_IIC
UART
flash
cubemx
packages_软件包
freemodbus
潘多拉开发板_Pandora
PWM
定时器
ADC
BSP
中断
编译报错
socket
keil_MDK
GD32
MicroPython
msh
Debug
ulog
SFUD
flashDB
SDIO总线
rt_mq_消息队列_msg_queue
本月问答贡献
用户名由3_15位
19
个答案
3
次被采纳
踩姑娘的小蘑菇
16
个答案
3
次被采纳
xiaorui
7
个答案
3
次被采纳
sakumisu
5
个答案
3
次被采纳
三世执戟
32
个答案
1
次被采纳
本月文章贡献
比特饼干
3
篇文章
10
次点赞
Z_Y
2
篇文章
5
次点赞
xusiwei1236
2
篇文章
3
次点赞
yinxiangxv
2
篇文章
3
次点赞
Alipay
2
篇文章
3
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部