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.
Diff: led.cpp
- Revision:
- 20:85a44ddbdc41
- Parent:
- 19:6ad1702c5d90
--- a/led.cpp Fri Nov 27 10:24:41 2015 +0000
+++ b/led.cpp Fri Nov 27 12:37:31 2015 +0000
@@ -36,11 +36,13 @@
return *LedOut;
}
-void Led::Toggle(){
- if(this -> Status()){
- this->Off();
- }else{
- this->On();
- }
- wait(0.1f);
+bool Led::Toggle(){
+ if(this -> Status()){ // Checks if the current Pin out Status is on (true)
+ this->Off(); // turn LED off
+ return *LedOut; // return LED Status as Off
+ }
+ else{ // If Led is off
+ this->On(); // Turn Led on
+ return *LedOut; // return LED Status as On
+ }
}