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:
- 1:16b0f2898739
- Child:
- 17:d46ebce20be0
diff -r c912cdfab475 -r 16b0f2898739 led.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/led.cpp Thu Oct 15 11:20:49 2015 +0000
@@ -0,0 +1,33 @@
+#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();
+}
\ No newline at end of file