LED with mutex protect
Dependencies: C12832 LM75B mbed-rtos mbed
Fork of Case_Study_rtos_basic by
main.cpp
- Committer:
- cathal66
- Date:
- 2015-02-12
- Revision:
- 7:10edddb7f1a8
- Parent:
- 3:c92e21f305d8
- Child:
- 8:0f773a5937f0
File content as of revision 7:10edddb7f1a8:
#include "mbed.h" //Include the mbed.h file #include "rtos.h" //include the RTOS.h file DigitalOut led1(LED1); //Setup LED1 to the varible name led1 DigitalOut led2(LED2); //Setup LED2 to the varible name led2 void led2_thread(void const *args) { //Function or the thread to be called while (true) { //Super loop led2 = !led2; //Toggle led2 Thread::wait(1000); //Thread wait 1 sec } //End Super loop } //End Function / thread int main() { //Main Thread thread(led2_thread); //Setup led2_thread as a thread with the name "thread" while (true) { //Super loop led1 = !led1; //Toggle led1 Thread::wait(500); //thread wait 500msec } //End super loop } //End main