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.
Dependencies: BME280 BMP280 TextLCD
LED.cpp
00001 #include "mbed.h" 00002 #include "LED.hpp" 00003 00004 00005 LED::LED(PinName pinName):pin(pinName)//Constuctor 00006 //Constuctor runs whenever a new instave of the class is created 00007 //The constructor has the same name as the class 00008 //The constructor does not have a return type 00009 //When called it needs to be given parameters Led redLed(D7); 00010 { 00011 00012 } 00013 00014 void LED::switchOn() //type void class is Led function is switchon 00015 { 00016 this->pin =1; //You access the attributes of the class by using the this command and then the name of the attribute 00017 } 00018 00019 void LED::switchOff() 00020 { 00021 this->pin =0; 00022 } 00023 void LED::flash(float time) 00024 { 00025 this->pin = 1; 00026 wait(time); 00027 this->pin = 0; 00028 } 00029 void LED::Toggle() 00030 { 00031 this->pin= !this->pin; 00032 }
Generated on Sun Jul 31 2022 05:12:27 by
1.7.2