Arduino 多线程简单代码


转载:

1.   https://www.csdn.net/gather_27/MtTaggzsMDExMS1ibG9n.html

2.   https://v.youku.com/v_show/id_XNzYxMDQ1NDIw.html?refer=seo_operation.liuxiao.liux_00003308_3000_YvmIba_19042900

#include <SCoop.h>

int count =0;
defineTaskLoop(Task2){Serial.println(count++); sleep(1);}
defineTask(Task1) void Task1::setup(){pinMode(13, OUTPUT);} void Task1::loop(){digitalWrite(13, !digitalRead(13)); sleep(1000);} void setup() { // put your setup code here, to run once: Serial.begin(9600); mySCoop.start(); } void loop() { // put your main code here, to run repeatedly: yield(); }



原文地址:https://www.cnblogs.com/MCSFX/p/12736032.html