Arduino 多线程简单代码
转载:
1. https://www.csdn.net/gather_27/MtTaggzsMDExMS1ibG9n.html
#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();
}