ARM Shanghai IoT Team (Internal) / Mbed 2 deprecated TickerClassDemo_JacobShi

Dependencies:   mbed

Fork of Ticker_HelloWorld by mbed official

Files at this revision

API Documentation at this revision

Comitter:
shiyilei
Date:
Tue Oct 21 15:27:35 2014 +0000
Parent:
1:ce38014095c9
Commit message:
use the Ticker class to make a breathing led

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ce38014095c9 -r 7a5c6bccf83c main.cpp
--- a/main.cpp	Sun Sep 21 18:11:54 2014 +0000
+++ b/main.cpp	Tue Oct 21 15:27:35 2014 +0000
@@ -1,20 +1,24 @@
+/****************************************************************
+*file name : breathing led
+*Creator:JacobShi
+*Time:2014/10/20
+* Description :use the Ticker class to make a breathing led
+ *************************************************************/
 #include "mbed.h"
- 
-Ticker flipper;
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
- 
-void flip() {
-    led2 = !led2;
+Ticker  basetime;
+
+DigitalOut myled(LED1);
+void led_change(void)
+{
+    myled=!myled;
 }
- 
-int main() {
-    led2 = 1;
-    flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds)
- 
-    // spin in a main loop. flipper will interrupt it to call flip
-    while(1) {
-        led1 = !led1;
-        wait(0.2);
+
+
+int main(void)
+{
+    basetime.attach(&led_change,1);
+    while(1)
+    {
+
     }
 }
\ No newline at end of file