Plymouth ELEC351 Group T
/
ELEC351_Group_T
FINAL PROJECT isn't it
Fork of ELEC351 by
LED.cpp
- Committer:
- thomasmorris
- Date:
- 2018-01-09
- Revision:
- 52:99915f5240b2
- Parent:
- 51:47f5db68500b
File content as of revision 52:99915f5240b2:
#include "LED.hpp" LED::LED(PinName pinName):pin(pinName)//Constuctor //Constuctor runs whenever a new instave of the class is created //The constructor has the same name as the class //The constructor does not have a return type //When called it needs to be given parameters Led redLed(D7); { } void LED::switchOn() //type void class is Led function is switchon { this->pin =1; //You access the attributes of the class by using the this command and then the name of the attribute } void LED::switchOff()//Turns off the LED { this->pin =0; } void LED::flash(float time)//Flashes the LED for the time passed in { this->pin = 1; Thread::wait(time); this->pin = 0; } void LED::Toggle()//Toggles the current state of the LED { this->pin= !this->pin; }