Matthew Shuman
/
Lab1TestAdvanced2
This provides a template for how to use a .h file to help organize a larger program into classes.
Diff: Blinker.h
- Revision:
- 0:dff21578688b
- Child:
- 1:a0232594b518
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Blinker.h Sat Aug 13 01:25:25 2016 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +// this class file is a template on using .h files. +class Blinker +{ +public: + Blinker(void) { +// _pin(pin) means pass pin to the Blinker Constructor + }; +// 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; + wait(duration); + outputLED = 1.0; + wait(duration); + }; + +private: + +}; \ No newline at end of file