Library A: LED library to controll the led on the Happy Gecko.

Dependencies:   mbed mbed

Files at this revision

API Documentation at this revision

Comitter:
diana_s
Date:
Mon Feb 12 21:40:22 2018 +0000
Parent:
0:3cabc617d433
Commit message:
updated doc;

Changed in this revision

LED.h Show annotated file Show diff for this revision Revisions of this file
led.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/LED.h	Sat Nov 18 17:03:48 2017 +0000
+++ b/LED.h	Mon Feb 12 21:40:22 2018 +0000
@@ -6,8 +6,36 @@
 
 /** LED class.
  *  To use the library, its header file needs to be included and an object of the LED class created.
+ 
+ * Example: Turns the LED0 on. 
+ * @code
+ * #include "mbed.h"
+ * #include "LED.h"
+ *
+ *  LED gpio(LED0);
+ * 
+ * int main() {
+ *     gpio.ledOn();
+ * }
 
  *  @endcode
+ 
+* Example2: Toggles the LED on and off. 
+ * @code
+ * #include "mbed.h"
+ * #include "LED.h"
+ *
+ *  LED gpio(LED0);
+ * 
+ * int main() {
+ *  gpio.toggle();
+ *  wait(0.2);
+ *  gpio.toggle();
+ *  wait(0.2);
+ * }
+
+ *  @endcode
+ 
  */
 
 
@@ -25,8 +53,12 @@
      /** This function inverts the value of the led.
          */ 
     void toggle();
-     /** This function makes the led blink on a specific duration.
-         */ 
+    
+    /** This function makes the led blink on a specific duration.
+     *
+     * @param duration specifies how long the functions is going to wait during the blink.
+     */
+     
     void blink(float duration);
   
 private:  
--- a/led.cpp	Sat Nov 18 17:03:48 2017 +0000
+++ b/led.cpp	Mon Feb 12 21:40:22 2018 +0000
@@ -17,6 +17,7 @@
     LEDpin = !LEDpin;
 }
 
+
 void LED::blink(float duration) {
     this->toggle();
     wait(duration);