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.
Diff: main.cpp
- Revision:
- 0:499187cdf585
- Child:
- 1:4e4ec828f10a
diff -r 000000000000 -r 499187cdf585 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Apr 05 23:56:30 2014 +0000
@@ -0,0 +1,27 @@
+#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 niz[4] = {0,1,2,3};
+ for (int i = 0; i<4; i++) {
+ myled[i] = 1;
+ thread_led[i] = new Thread(start_blink, &niz[i]);
+ }
+}