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.
led.cpp
- Committer:
- Oschofield
- Date:
- 2015-11-27
- Revision:
- 18:106b4cb3a647
- Parent:
- 17:d46ebce20be0
- Child:
- 19:6ad1702c5d90
File content as of revision 18:106b4cb3a647:
#include "led.h" //include header file //constructor Led::Led(string s){ //Constructor implementation if(s == "red") pin = PD_14; else if(s == "blue") pin = PD_15; else if(s == "green") pin = PD_12; else if(s == "orange") pin = PD_13; LedOut = new DigitalOut(pin); } void Led::On(){ LedOut -> write(1); } void Led::Off(){ LedOut -> write(0); } void Led::Flash(float Delay){ wait(Delay); On(); wait(Delay); Off(); } bool Led::Status(){ return *LedOut; } void Led::Toggle(){ if(this -> Status()){ this->Off(); }else{ this->On(); } }