Time: 17:33 Date: 10/12/2017 Description: Task 1,7,8 Currently Functioning

Dependencies:   BME280 BMP280 TextLCD

Working Repository

LED.cpp

Committer:
thomasmorris
Date:
2018-01-09
Revision:
50:3d61ca637399
Parent:
5:2594b953f111

File content as of revision 50:3d61ca637399:

#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;
}