Simple library for LED blinking.

Dependents:   roam_v2 finalV1 finalV1 finalv2 ... more

Files at this revision

API Documentation at this revision

Comitter:
tbjazic
Date:
Sun Nov 15 09:12:51 2015 +0000
Parent:
1:ea5bb72717cc
Child:
3:286a364f952f
Commit message:
Documentation updated.

Changed in this revision

Blinker.cpp Show annotated file Show diff for this revision Revisions of this file
Blinker.h Show annotated file Show diff for this revision Revisions of this file
--- a/Blinker.cpp	Tue Dec 16 09:25:44 2014 +0000
+++ b/Blinker.cpp	Sun Nov 15 09:12:51 2015 +0000
@@ -8,8 +8,8 @@
 void Blinker::blink(int n, float t) {
     for (int i = 0; i < n; i++) {
             myled = 1;
-            wait(t);
+            wait(t/2);
             myled = 0;
-            wait(t);
+            wait(t/2);
     }
 }
\ No newline at end of file
--- a/Blinker.h	Tue Dec 16 09:25:44 2014 +0000
+++ b/Blinker.h	Sun Nov 15 09:12:51 2015 +0000
@@ -3,7 +3,10 @@
 
 #include "mbed.h"
 
-/** Simple class for learning development of libraries.
+/** Simple class for learning development of libraries. The main task
+ *  is to blink (flash) a LED connected to a specified pin N times. 
+ * Each blink should last 0.5 seconds by default, or some other time
+ * that user can set.
  * 
  * Author: TVZ Mechatronics Team
  *
@@ -13,10 +16,10 @@
  * #include "Blinker.h"
  *
  * int main() {
- *    Blinker mojBlinker(LED3);
- *    mojBlinker.blink(10);
+ *    Blinker myBlinker(LED3);
+ *    myBlinker.blink(10);
  *    wait(2);
- *    mojBlinker.blink(5, 0.5);
+ *    myBlinker.blink(5, 1);
  * }
  * @endcode
  */
@@ -24,8 +27,10 @@
 private:
     DigitalOut myled;
 public:
+    /** Constructor receives a pin name that LED is connected to. */
     Blinker(PinName pin);
-    void blink(int n, float t = 0.2);
+    /** Function recevies number of blinks (flashes) and a time of duration of each blink. */
+    void blink(int n, float t = 0.5);
 };
 
 #endif
\ No newline at end of file