FINAL PROJECT isn't it

Fork of ELEC351 by Plymouth ELEC351 Group T

Committer:
thomasmorris
Date:
Tue Jan 09 22:27:49 2018 +0000
Revision:
52:99915f5240b2
Parent:
51:47f5db68500b
ITS THE FINAL COMMIT MESSAGE DO DO DO DO DO

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thomasmorris 51:47f5db68500b 1 /*
thomasmorris 52:99915f5240b2 2 This is our LED Class it enables us to write to an 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 52:99915f5240b2 10 //Libraries and header includes
thomasmorris 52:99915f5240b2 11 #include "THREADS.hpp"
thomasmorris 52:99915f5240b2 12 #include "mbed.h"
thomasmorris 52:99915f5240b2 13 #include "rtos.h"
thomasmorris 52:99915f5240b2 14 class LED //This creates a class called Led
thomasmorris 5:2594b953f111 15 {
thomasmorris 5:2594b953f111 16 //Below are methods of the class these are the opperations the class will support
thomasmorris 52:99915f5240b2 17 public:
thomasmorris 5:2594b953f111 18
thomasmorris 5:2594b953f111 19 LED(PinName pinName);
thomasmorris 52:99915f5240b2 20 void switchOn(); //Void is the return type as no values will be output the return type is void
thomasmorris 52:99915f5240b2 21 void switchOff(); //SwitchOff is the name of the method/function
thomasmorris 52:99915f5240b2 22 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 52:99915f5240b2 23 void Toggle(); //This Toggles the LED object with a thread wait
thomasmorris 5:2594b953f111 24
thomasmorris 52:99915f5240b2 25 private: //This is used here to make digitalout pin only useable from inside class Led
thomasmorris 52:99915f5240b2 26 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 27 };
thomasmorris 5:2594b953f111 28 #endif