Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ELEC351_Group_T by
LED.cpp
00001 #include "LED.hpp" 00002 00003 00004 LED::LED(PinName pinName):pin(pinName)//Constuctor 00005 //Constuctor runs whenever a new instave of the class is created 00006 //The constructor has the same name as the class 00007 //The constructor does not have a return type 00008 //When called it needs to be given parameters Led redLed(D7); 00009 { 00010 00011 } 00012 00013 void LED::switchOn() //type void class is Led function is switchon 00014 { 00015 this->pin =1; //You access the attributes of the class by using the this command and then the name of the attribute 00016 } 00017 00018 void LED::switchOff()//Turns off the LED 00019 { 00020 this->pin =0; 00021 } 00022 void LED::flash(float time)//Flashes the LED for the time passed in 00023 { 00024 this->pin = 1; 00025 Thread::wait(time); 00026 this->pin = 0; 00027 } 00028 void LED::Toggle()//Toggles the current state of the LED 00029 { 00030 this->pin= !this->pin; 00031 }
Generated on Tue Jul 12 2022 22:52:51 by
