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:4e5540dd971c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jun 13 20:02:28 2012 +0000
@@ -0,0 +1,25 @@
+//A simple test program to makes LEDs cycle left to right and then right to left.
+
+#include "mbed.h"
+
+PwmOut ledarray[4] = { LED1, LED2, LED3, LED4 };
+
+int main() {
+ bool forward = true;
+ int position = 0;
+
+ while (1) {
+ if (position == 0) forward = true;
+ else if (position == 3) forward = false;
+
+ if (forward) position++;
+ else position--;
+
+ for (int i=0;i<4;i++) {
+ if (i==position) ledarray[i] = 1.0;
+ else if ((i==position-1) || (i==position+1)) ledarray[i] = 0.2;
+ else ledarray[i] = 0.0;
+ }
+ wait(0.2);
+ }
+}