four leds are enlightened and dimmed by tickers.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
titanium
Date:
Tue May 15 04:21:27 2018 +0000
Parent:
2:768c88a138c2
Commit message:
four lines are hidden

Changed in this revision

timer_multi_blinky.cpp Show diff for this revision Revisions of this file
timer_multi_blinky_unfinished.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/timer_multi_blinky.cpp	Sun Apr 01 04:18:25 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#include "mbed.h"
-
-Ticker timer1, timer2, timer3, timer4, timer5;
-DigitalOut digled1(LED1), digled2(LED2);
-PwmOut pwmled3(LED3), pwmled4(LED4);
-DigitalOut digout7(p7);
-Serial pc(USBTX, USBRX);
-
-void flipled1()  { digled1 = !digled1;}
-void flipled2 () { digled2 = !digled2; }
-void changeled3()
-{ static int seq=0;
-  seq=(seq+1) % 100; // 1-100
-  pwmled3.write(seq/200.0);    }
-void changeled4() 
-{ static int seq=0;
-  seq=(seq+1) % 100; // 1-100
-  pwmled4.write(seq/200.0);    }
-void report_led() 
-{ static int count=0;
-  pc.printf(" count:%d   %d  %d  %f  %f\r\n",
-            ++count, digled1.read(), digled2.read(), pwmled3.read(), pwmled4.read()); }
-
-int main() {
-   pc.printf("Timer driven multi led blinker.\n\r");
-   timer1.attach(&flipled1, 0.8);
-   timer2.attach(&flipled2, 0.35);
-   timer3.attach(&changeled3, 0.007);
-   timer4.attach(&changeled4, 0.013);
-   timer5.attach(&report_led, 1.0);
-   while(1) { digout7= ! digout7; }    } //See how fast GPIO can be toggled.
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timer_multi_blinky_unfinished.cpp	Tue May 15 04:21:27 2018 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+
+Ticker timer1, timer2, timer3, timer4, timer5;
+DigitalOut digled1(LED1), digled2(LED2);
+PwmOut pwmled3(LED3), pwmled4(LED4);
+DigitalOut digout7(p7);
+Serial pc(USBTX, USBRX);
+
+void flipled1()  { digled1 = !digled1;}
+void flipled2 () { digled2 = !digled2; }
+void changeled3()
+{ static int seq=0;
+  seq=(seq+1) % 100; // 1-100
+  pwmled3.write(seq/200.0);    }
+void changeled4() 
+{ static int seq=0;
+  seq=(seq+1) % 100; // 1-100
+  pwmled4.write(seq/200.0);    }
+void report_led() 
+{ static int count=0;
+  pc.printf(" count:%d   %d  %d  %f  %f\r\n",
+            ++count, digled1.read(), digled2.read(), pwmled3.read(), pwmled4.read()); }
+
+int main() {
+   pc.printf("Timer driven multi led blinker.\n\r");
+   
+   // fill in four lines to start timer tasks
+
+   while(1) { digout7= ! digout7; }    } //See how fast GPIO can be toggled.
+