Using inbuilt libraries to write LDR values to the LCD

Dependencies:   TextLCD mbed-rtos mbed

Fork of ELEC_350_Coursework by Chris Hills

Led.cpp

Committer:
thomasmorris
Date:
2017-12-10
Revision:
2:670823ed7cfc
Parent:
0:8f564feffdd8

File content as of revision 2:670823ed7cfc:

#include "mbed.h"
#include "Led.h"


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