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.
Fork of Case_Study_rtos_signals2 by
main.cpp
- Committer:
- cathal66
- Date:
- 2015-02-13
- Revision:
- 5:47c0e14dbd4a
- Parent:
- 1:6a8fcc666593
- Child:
- 6:6263aeb45282
File content as of revision 5:47c0e14dbd4a:
#include "mbed.h"
#include "rtos.h"
PwmOut led(p25); //setup LED for PWM
void led_thread(void const *argument) {
while (true) {
// Signal flags that are reported as event are automatically cleared.
Thread::signal_wait(0x1); //Wait for flag "0x1" to be set after thread wait for 1000 msec
led = !led; //toggle the LED
}
}
int main (void) {
Thread thread(led_thread); //start thread
while (true) {
Thread::wait(1000); //thread wait for 1000 msec
thread.signal_set(0x1); //set the flag for "0x1"
}
}
