ELEC350 Coursework Repository
Dependencies: TextLCD mbed-rtos mbed
Led.h@0:8f564feffdd8, 2017-11-25 (annotated)
- Committer:
- thomasmorris
- Date:
- Sat Nov 25 15:39:56 2017 +0000
- Revision:
- 0:8f564feffdd8
Version_1.0; Working LCD
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 0:8f564feffdd8 | 1 | #ifndef _LED_H_ //Known as header guards |
thomasmorris | 0:8f564feffdd8 | 2 | #define _LED_H_ |
thomasmorris | 0:8f564feffdd8 | 3 | |
thomasmorris | 0:8f564feffdd8 | 4 | class Led //This creates a class called Led |
thomasmorris | 0:8f564feffdd8 | 5 | { |
thomasmorris | 0:8f564feffdd8 | 6 | |
thomasmorris | 0:8f564feffdd8 | 7 | //Below are methods of the class these are the opperations the class will support |
thomasmorris | 0:8f564feffdd8 | 8 | public: //The public: word enables the methods to be accessed outside of the class itself |
thomasmorris | 0:8f564feffdd8 | 9 | |
thomasmorris | 0:8f564feffdd8 | 10 | Led(PinName pinName); |
thomasmorris | 0:8f564feffdd8 | 11 | void switchOn(); //Void is the return type as no values will be output the return type is void |
thomasmorris | 0:8f564feffdd8 | 12 | void switchOff(); //SwitchOff is the name of the method/function |
thomasmorris | 0:8f564feffdd8 | 13 | 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 | 0:8f564feffdd8 | 14 | void Toggle(); |
thomasmorris | 0:8f564feffdd8 | 15 | |
thomasmorris | 0:8f564feffdd8 | 16 | private: //This is used here to make digitalout pin only useable from inside class Led |
thomasmorris | 0:8f564feffdd8 | 17 | 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 | 0:8f564feffdd8 | 18 | }; |
thomasmorris | 0:8f564feffdd8 | 19 | |
thomasmorris | 0:8f564feffdd8 | 20 | |
thomasmorris | 0:8f564feffdd8 | 21 | #endif |