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: TextLCD mbed-rtos mbed
Fork of ELEC_350_Coursework by
Diff: Led.cpp
- Revision:
- 0:8f564feffdd8
diff -r 000000000000 -r 8f564feffdd8 Led.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led.cpp Sat Nov 25 15:39:56 2017 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "Led.h"
+
+
+Led::Led(PinName pinName):pin(pinName)//Constuctor
+//Constuctor runs whenever a new instave of the class is created
+//The constructor has the same name as the class
+//The constructor does not have a return type
+//When called it needs to be given parameters Led redLed(D7);
+{
+
+}
+
+void Led::switchOn() //type void class is Led function is switchon
+{
+ this->pin =1; //You access the attributes of the class by using the this command and then the name of the attribute
+}
+
+void Led::switchOff()
+{
+ this->pin =0;
+}
+void Led::flash(float time)
+{
+ this->pin = 1;
+ wait(time);
+ this->pin = 0;
+}
+void Led::Toggle()
+{
+ this->pin= !this->pin;
+}
\ No newline at end of file
