Matthew Shuman
/
Lab1TestAdvanced2
This provides a template for how to use a .h file to help organize a larger program into classes.
Blinker.h
- Committer:
- mattshuman
- Date:
- 2016-08-13
- Revision:
- 0:dff21578688b
- Child:
- 1:a0232594b518
File content as of revision 0:dff21578688b:
#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: };