arduino多线程

2018-04-101.6万
AI 快速预览详细 收起
本文讨论了在使用Arduino的ProtoThread库时遇到的编译错误,并提供了具体的解决方法。通过将函数声明从'extern'改为'static',可以解决'extern'和'static'声明冲突的问题。该方法适用于Arduino/Genuino Mega 2560开发板,帮助用户快速排除故障,节省调试时间。
我现在调用Arduino的ProtoThread库,可是编译的时候报错了:
Arduino:1.6.6 (Windows 10), 开发板:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\Administrator\Documents\Arduino\libraries\ProtoThreads\examples\ExampleSmall\ExampleSmall.pde: In function 'int protothread1(pt*)':

ExampleSmall:24: error: 'int protothread1(pt*)' was declared 'extern' and later 'static' [-fpermissive]

static int protothread1(struct pt *pt)

                                      ^

ExampleSmall:24: error: previous declaration of 'int protothread1(pt*)' [-fpermissive]

static int protothread1(struct pt *pt)

     ^

C:\Users\Administrator\Documents\Arduino\libraries\ProtoThreads\examples\ExampleSmall\ExampleSmall.pde: In function 'int protothread2(pt*)':

ExampleSmall:53: error: 'int protothread2(pt*)' was declared 'extern' and later 'static' [-fpermissive]

static int protothread2(struct pt *pt)

                                      ^

ExampleSmall:25: error: previous declaration of 'int protothread2(pt*)' [-fpermissive]

{

     ^

exit status 1
'int protothread1(pt*)' was declared 'extern' and later 'static' [-fpermissive]

  报告将会包含更多的信息
  "在编译时,输出详细信息"
  在 文件>首选项 中启用


是怎么一回事?

创作许可协议

本项目采用 None(不开放任何权利,保留所有权利) 进行许可。

评论(3)
twfolove
twfolove
就这个硬件资源基本就告别多线程了
20060606
20060606
我也看不懂,不过你可以用ardublock2015的多线程
wan_2
wan_2
看不懂哦,路过哈哈哈
- 没有更多了 -