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:c058fc45eb34
- Child:
- 1:486592635dfd
diff -r 000000000000 -r c058fc45eb34 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Jul 04 05:51:22 2010 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
+int timeBase = 0;
+
+void tick() {
+ if ((timeBase += 1) == 10) {
+ timeBase = 0;
+ }
+}
+
+void blink(DigitalOut *led, int timing) {
+ if ((timeBase % timing) == 0) {
+ if (led->read() == 0) {
+ led->write(1);
+ } else {
+ led->write(0);
+ }
+ }
+}
+
+int main() {
+ while(1) {
+ blink(&myled1, 1);
+ blink(&myled2, 2);
+ blink(&myled3, 3);
+ blink(&myled4, 4);
+ tick();
+ wait(0.1);
+ }
+}