Thomas Morris
/
PROJ324_Final
Proj 324 Final
Fork of ELEC351_Group_T by
LED.hpp@51:47f5db68500b, 2018-01-09 (annotated)
- Committer:
- thomasmorris
- Date:
- Tue Jan 09 15:15:08 2018 +0000
- Revision:
- 51:47f5db68500b
- Parent:
- 5:2594b953f111
- Child:
- 52:99915f5240b2
Commenting Left; Sort out LCD number problem.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 51:47f5db68500b | 1 | /* |
thomasmorris | 51:47f5db68500b | 2 | This is our LED Class it enables us to write to LED |
thomasmorris | 51:47f5db68500b | 3 | quickly and easily and it encapsulates a few functions |
thomasmorris | 51:47f5db68500b | 4 | to prompt ease of use. |
thomasmorris | 51:47f5db68500b | 5 | */ |
thomasmorris | 51:47f5db68500b | 6 | |
thomasmorris | 51:47f5db68500b | 7 | #ifndef LED_HPP//Header Guards Prevents Multiple includes |
thomasmorris | 51:47f5db68500b | 8 | #define LED_HPP |
thomasmorris | 5:2594b953f111 | 9 | |
thomasmorris | 5:2594b953f111 | 10 | class LED //This creates a class called Led |
thomasmorris | 5:2594b953f111 | 11 | { |
thomasmorris | 5:2594b953f111 | 12 | |
thomasmorris | 5:2594b953f111 | 13 | //Below are methods of the class these are the opperations the class will support |
thomasmorris | 5:2594b953f111 | 14 | public: //The public: word enables the methods to be accessed outside of the class itself |
thomasmorris | 5:2594b953f111 | 15 | |
thomasmorris | 5:2594b953f111 | 16 | LED(PinName pinName); |
thomasmorris | 5:2594b953f111 | 17 | void switchOn(); //Void is the return type as no values will be output the return type is void |
thomasmorris | 5:2594b953f111 | 18 | void switchOff(); //SwitchOff is the name of the method/function |
thomasmorris | 5:2594b953f111 | 19 | void flash(float time); //float time is the parameter of the function in this case it creates a floating poi t variable known as time and this is then passed o the function when called. |
thomasmorris | 5:2594b953f111 | 20 | void Toggle(); |
thomasmorris | 5:2594b953f111 | 21 | |
thomasmorris | 5:2594b953f111 | 22 | private: //This is used here to make digitalout pin only useable from inside class Led |
thomasmorris | 5:2594b953f111 | 23 | DigitalOut pin; //DigitalOut is the Class and the object is called pin the object pin is now an attribute of led this is also known as a member variable or field |
thomasmorris | 5:2594b953f111 | 24 | }; |
thomasmorris | 5:2594b953f111 | 25 | |
thomasmorris | 5:2594b953f111 | 26 | |
thomasmorris | 5:2594b953f111 | 27 | #endif |