using threads to sleep not wait

Programming the EMW3166 on the AZ3166 IOT Dev Kit using the online MBED compiler. This program show how to use thread sleep instead of wait.

main.cpp

Committer:
appa
Date:
22 months ago
Revision:
1:5bc12bf152c4
Parent:
0:69a64e9b0590

File content as of revision 1:5bc12bf152c4:

#include "mbed.h"
#include "platform/mbed_thread.h"
@ last tested 12/4/2022
#define SleepTime 200

DigitalOut led1(LED1);

int main() {
    while(1) {
        led1 = 1;
        thread_sleep_for(SleepTime);
        led1 = 0;
        thread_sleep_for(SleepTime);
    }
}