Example showing comments.

Dependencies:   mbed

Revision:
0:fbca7accb93b
diff -r 000000000000 -r fbca7accb93b Blinker.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Blinker.h	Sat Aug 13 01:47:43 2016 +0000
@@ -0,0 +1,38 @@
+/*! Lab1TestAdvanced3
+ *  Used for advanced LED blinking with the FRDM-KL46Z.  This adds a .h file to leverage modularity and also provides an example of a proper commenting style.
+ * \author  Matthew Shuman
+ *
+ * \date    August 12th, 2016
+
+ * \bug     No bugs yet
+
+ * @code
+ * #include "mbed.h"
+ *
+ * outputLED may be r or g, frequency is in Hertz, and brightness can range between 0 and 1.
+ * void blink(output LED, frequency, brightness)
+ * {
+ * }
+ * @endcode
+ */
+ 
+#include "mbed.h"
+// this class file is a template on using .h files.
+class Blinker
+{
+public:
+    Blinker(void) {
+    };
+// class method to blink and LED based on the PwmOut class
+    void blink(PwmOut outputLED, float frequency, float brightness) {
+        outputLED.period(.001f);
+        outputLED = 1- brightness;
+        float duration = (1.0/frequency)/2;  //dividing by 2 lets the microcontroller wait for half of the period before changing the LED.
+        wait(duration);
+        outputLED = 1.0;  //LED is active low, so setting this to 1 turns off the LED.
+        wait(duration);
+    };
+
+private:
+    
+};
\ No newline at end of file