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:c606bb1acbdc
diff -r 000000000000 -r c606bb1acbdc main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 29 18:55:33 2010 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+
+// a flashlight with 4 Leds like the KID in Nightrider
+
+PwmOut led_1(LED1);
+PwmOut led_2(LED2);
+PwmOut led_3(LED3);
+PwmOut led_4(LED4);
+
+int main() {
+
+float
+q;
+
+ while(1) {
+ for(float p = 0.0f; p < 4.0f; p += 0.1f) {
+ led_1 = p;
+ led_2 = p-1.0;
+ led_3 = p-2.0;
+ led_4 = p-3.0;
+ wait(0.01);
+ }
+ for(float p = 4.0f; p > 0.0f; p -= 0.1f) {
+ led_4 = p;
+ led_3 = p-1.0;
+ led_2 = p-2.0;
+ led_1 = p-3.0;
+ wait(0.01);
+ }
+ for(float p = 0.0f; p < 4.0f; p += 0.1f) {
+ led_4 = p;
+ led_3 = p-1.0;
+ led_2 = p-2.0;
+ led_1 = p-3.0;
+ wait(0.01);
+ }
+ for(float p = 4.0f; p > 0.0f; p -= 0.1f) {
+ led_1 = p;
+ led_2 = p-1.0;
+ led_3 = p-2.0;
+ led_4 = p-3.0;
+ wait(0.01);
+ }
+ }
+}
\ No newline at end of file