Rob Toulson / Mbed 2 deprecated PE_09-09_TickerDemo

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
robt
Date:
Fri May 24 21:49:20 2013 +0000
Commit message:
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 24 21:49:20 2013 +0000
@@ -0,0 +1,18 @@
+/* Program Example 9.9: Simple demo of "Ticker". Replicates behaviour of first
+led flashing program.   
+                                                                            */
+#include "mbed.h"
+void led_switch(void);
+Ticker time_up;                         //define a Ticker, with name “time_up”
+DigitalOut myled(LED1);
+
+void led_switch(){                      //the function that Ticker will call
+    myled=!myled;       
+}
+
+int main(){
+    time_up.attach(&led_switch, 0.2);             //initialises the ticker 
+    while(1){        //sit in a loop doing nothing, waiting for Ticker interrupt
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 24 21:49:20 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file