Example showing comments.

Dependencies:   mbed

Committer:
mattshuman
Date:
Sat Aug 13 01:47:43 2016 +0000
Revision:
0:fbca7accb93b
Removed artifacts from source code.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mattshuman 0:fbca7accb93b 1 /*! Lab1TestAdvanced3
mattshuman 0:fbca7accb93b 2 * 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.
mattshuman 0:fbca7accb93b 3 * \author Matthew Shuman
mattshuman 0:fbca7accb93b 4 *
mattshuman 0:fbca7accb93b 5 * \date August 12th, 2016
mattshuman 0:fbca7accb93b 6
mattshuman 0:fbca7accb93b 7 * \bug No bugs yet
mattshuman 0:fbca7accb93b 8
mattshuman 0:fbca7accb93b 9 * @code
mattshuman 0:fbca7accb93b 10 * #include "mbed.h"
mattshuman 0:fbca7accb93b 11 * #include "Blinker.h"
mattshuman 0:fbca7accb93b 12 *
mattshuman 0:fbca7accb93b 13 * PwmOut r(LED_RED);
mattshuman 0:fbca7accb93b 14 *
mattshuman 0:fbca7accb93b 15 * int main()
mattshuman 0:fbca7accb93b 16 * {
mattshuman 0:fbca7accb93b 17 * Blinker myBlinker;
mattshuman 0:fbca7accb93b 18 * while(1) {
mattshuman 0:fbca7accb93b 19 * for(float i = 0; i < 5; i++) { //Blink the LED 5 times
mattshuman 0:fbca7accb93b 20 * myBlinker.blink(r or g, frequency in Hertz, % brightness (0 - 1.00) );
mattshuman 0:fbca7accb93b 21 * }
mattshuman 0:fbca7accb93b 22 * }//end of while
mattshuman 0:fbca7accb93b 23 * }//end of main
mattshuman 0:fbca7accb93b 24 * @endcode
mattshuman 0:fbca7accb93b 25 */
mattshuman 0:fbca7accb93b 26
mattshuman 0:fbca7accb93b 27 #include "mbed.h"
mattshuman 0:fbca7accb93b 28 #include "Blinker.h"
mattshuman 0:fbca7accb93b 29
mattshuman 0:fbca7accb93b 30 //This creates Pulse Width Modulated outputs, r and g, and connects them to the red and green LED.
mattshuman 0:fbca7accb93b 31 PwmOut r(LED_RED);
mattshuman 0:fbca7accb93b 32 PwmOut g(LED_GREEN);
mattshuman 0:fbca7accb93b 33
mattshuman 0:fbca7accb93b 34 int main()
mattshuman 0:fbca7accb93b 35 {
mattshuman 0:fbca7accb93b 36 // constructs member of new Blinker class, myBlinker
mattshuman 0:fbca7accb93b 37 Blinker myBlinker;
mattshuman 0:fbca7accb93b 38 while(1) {
mattshuman 0:fbca7accb93b 39 for(float i = 0; i < 5; i++) { //Blink the LED 5 times
mattshuman 0:fbca7accb93b 40 // blinks the green LED at 2 Hz, with 75% brightness
mattshuman 0:fbca7accb93b 41 myBlinker.blink(g, 2, .75);
mattshuman 0:fbca7accb93b 42 }
mattshuman 0:fbca7accb93b 43 for(float i = 0; i < 10; i++) { //Blink the LED 10 times
mattshuman 0:fbca7accb93b 44 // blinks the red LED at 4 Hz, with 15% brightness
mattshuman 0:fbca7accb93b 45 myBlinker.blink(r, 4, .15);
mattshuman 0:fbca7accb93b 46 }
mattshuman 0:fbca7accb93b 47 }//end of while
mattshuman 0:fbca7accb93b 48 }//end of main