Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832 LM75B mbed-rtos mbed
Fork of rtos_basic by
main.cpp
- Committer:
- cathal66
- Date:
- 2015-02-13
- Revision:
- 9:b4346bf47dd7
- Parent:
- 8:0f773a5937f0
- Child:
- 10:8635af078e7c
File content as of revision 9:b4346bf47dd7:
#include "mbed.h" //Include the mbed.h file
#include "rtos.h" //include the RTOS.h file
#include "LM75B.h"
#include "C12832.h"
C12832 lcd(p5, p7, p6, p8, p11);
Serial pc(USBTX,USBRX);
PwmOut LED_red(p23);
PwmOut LED_blue(p25);
DigitalOut led1(LED1); //Setup LED1 to the varible name led1
DigitalOut led2(LED2); //Setup LED2 to the varible name led2
Mutex LED_B_Mutex;
Mutex LED_R_Mutex;
void led_dim(void const *args) { //Function or the thread to be called
while (true) { //Super loop
LED_R_Mutex.lock();
LED_B_Mutex.lock();
LED_red = 0.5;
LED_blue = 1;
Thread::wait(800);
LED_R_Mutex.unlock();
LED_B_Mutex.unlock();
LED_R_Mutex.lock();
LED_B_Mutex.lock();
LED_red = 1;
LED_blue = 0.5;
Thread::wait(800);
LED_R_Mutex.unlock();
LED_B_Mutex.unlock();
} //End Super loop
}
void led_R_B_flash(void const *args) { //Function or the thread to be called
while (true) { //Super loop
LED_R_Mutex.lock();
LED_B_Mutex.lock();
LED_red = 0;
LED_blue = 1;
Thread::wait(800);
LED_R_Mutex.unlock();
LED_B_Mutex.unlock();
LED_R_Mutex.lock();
LED_B_Mutex.lock();
LED_red = 1;
LED_blue = 0;
Thread::wait(800);
LED_R_Mutex.unlock();
LED_B_Mutex.unlock();
} //End Super loop
} //End Function / thread
int main() { //Main
Thread thread_LED_Flash(led_R_B_flash);
Thread thread_LED_dim(led_dim);
while (1) {
printf("Hello_World\r\n");
Thread::wait(5000);
}
} //End main
