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.
main.cpp
- Committer:
- Heidi070221
- Date:
- 2014-04-06
- Revision:
- 1:4e4ec828f10a
- Parent:
- 0:499187cdf585
File content as of revision 1:4e4ec828f10a:
#include "mbed.h"
#include "rtos.h"
DigitalOut myled[5] = {(LED1), (LED2), (LED3), (LED4), (p21)};
Thread *thread_led[4];
const int LATENCY = 400;
void start_blink(void const *argument) {
int i = *(int*)argument;
while (1) {
myled[i] = !myled[i];
if (i == 3 && myled[3] == 1){
myled[4] = myled[2] && myled[1] && myled[0];
}
thread_led[i]->wait(pow (2.0,(3-i)) * LATENCY);
}
}
int main() {
int arr[4] = {0,1,2,3};
for (int i = 0; i<4; i++) {
myled[i] = 1;
thread_led[i] = new Thread(start_blink, &arr[i]);
}
}