mirror of
https://github.com/m5stack/M5Stack.git
synced 2026-05-20 10:06:46 -07:00
69 lines
1.9 KiB
Arduino
69 lines
1.9 KiB
Arduino
#include <M5Stack.h>
|
|
|
|
void task1(void * pvParameters) {
|
|
|
|
for(;;) {
|
|
Serial.print("task1 Uptime (ms): ");
|
|
Serial.println(millis());
|
|
delay(100);
|
|
}
|
|
}
|
|
|
|
void task2(void * pvParameters) {
|
|
|
|
for(;;) {
|
|
Serial.print("task2 Uptime (ms): ");
|
|
Serial.println(millis());
|
|
delay(200);
|
|
}
|
|
}
|
|
|
|
void task3(void * pvParameters) {
|
|
|
|
for(;;) {
|
|
Serial.print("task3 Uptime (ms): ");
|
|
Serial.println(millis());
|
|
delay(1000);
|
|
}
|
|
}
|
|
|
|
|
|
void setup() {
|
|
|
|
M5.begin();
|
|
|
|
// Task 1
|
|
xTaskCreatePinnedToCore(
|
|
task1, /* Function to implement the task */
|
|
"task1", /* Name of the task */
|
|
4096, /* Stack size in words */
|
|
NULL, /* Task input parameter */
|
|
1, /* Priority of the task */
|
|
NULL, /* Task handle. */
|
|
0); /* Core where the task should run */
|
|
|
|
// Task 2
|
|
xTaskCreatePinnedToCore(
|
|
task2, /* Function to implement the task */
|
|
"task2", /* Name of the task */
|
|
4096, /* Stack size in words */
|
|
NULL, /* Task input parameter */
|
|
2, /* Priority of the task */
|
|
NULL, /* Task handle. */
|
|
0); /* Core where the task should run */
|
|
|
|
// Task 3
|
|
xTaskCreatePinnedToCore(
|
|
task3, /* Function to implement the task */
|
|
"task3", /* Name of the task */
|
|
4096, /* Stack size in words */
|
|
NULL, /* Task input parameter */
|
|
3, /* Priority of the task */
|
|
NULL, /* Task handle. */
|
|
0); /* Core where the task should run */
|
|
}
|
|
|
|
void loop() {
|
|
|
|
M5.update();
|
|
} |