I tried a RTOS Thread example on the MBED web site.
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
Thread thread;
void led2_thread()
{
while (true) {
led2 = !led2;
ThisThread::sleep_for(1000);
}
}
int main()
{
thread.start(led2_thread);
while (true) {
led1 = !led1;
ThisThread::sleep_for(500);
}
}
But I got a compile error like below.
Error: Identifier “Thread” is undefined in “main.cpp”, Line: 5, Col: 2
I was set only importing mbed.h.
How can I use Thread?