#include <STM32FreeRTOS.h>
// Print a sequence one character at a time, yielding between each char
// so the scheduler can switch mid-sequence.
void printSeq(const char *seq) {
for (int i = 0; seq[i] != '\0'; i++) {
Serial.print(seq[i]);
vTaskDelay(pdMS_TO_TICKS(2)); // hand off mid-sequence
}
Serial.println();
}
void taskA(void *pv) {
for (;;) { printSeq("abcdefg"); vTaskDelay(pdMS_TO_TICKS(20)); }
}
void taskB(void *pv) {
for (;;) { printSeq("1234567"); vTaskDelay(pdMS_TO_TICKS(20)); }
}
void setup() {
Serial.begin(115200);
xTaskCreate(taskA, "A", 256, NULL, 1, NULL);
xTaskCreate(taskB, "B", 256, NULL, 1, NULL);
vTaskStartScheduler();
}
void loop() {}