![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Task 1,7,8 Working
Dependencies: BME280 BMP280 ELEC350-Coursework-2017 TextLCD
Fork of ELEC350-CWTEMPLATE-2017 by
Diff: LED.cpp
- Revision:
- 5:2594b953f111
diff -r d26b261b76c9 -r 2594b953f111 LED.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LED.cpp Sun Dec 10 17:30:00 2017 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#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() +{ + this->pin =0; +} +void LED::flash(float time) +{ + this->pin = 1; + wait(time); + this->pin = 0; +} +void LED::Toggle() +{ + this->pin= !this->pin; +} \ No newline at end of file