Thomas Morris / Mbed OS PROJ324_Final

Fork of ELEC351_Group_T by Plymouth ELEC351 Group T

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LED.hpp Source File

LED.hpp

00001 /*
00002 This is our LED Class it enables us to write to  an LED
00003 quickly and easily and it encapsulates a few functions
00004 to prompt ease of use.
00005 */
00006 
00007 #ifndef LED_HPP//Header Guards Prevents Multiple includes
00008 #define LED_HPP
00009 
00010 //Libraries and header includes
00011 #include "THREADS.hpp"
00012 #include "mbed.h"
00013 #include "rtos.h"
00014 class LED                       //This creates a class called Led
00015 {
00016 //Below are methods of the class these are the opperations the class will support
00017 public:
00018 
00019     LED(PinName pinName);
00020     void switchOn();            //Void is the return type as no values will be output the return type is void
00021     void switchOff();           //SwitchOff is the name of the method/function
00022     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.
00023     void Toggle();              //This Toggles the LED object with a thread wait
00024     
00025 private:                        //This is used here to make digitalout pin only useable from inside class Led    
00026     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    
00027 };
00028 #endif