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.
Revision 0:f37ec9490923, committed 2015-10-22
- Comitter:
- Toary
- Date:
- Thu Oct 22 10:46:46 2015 +0000
- Commit message:
- created my library
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led/Led.cpp Thu Oct 22 10:46:46 2015 +0000
@@ -0,0 +1,20 @@
+#include "Led.h"
+
+Led::Led(string s)
+{
+ if(s == "red")
+ pin = PD_14;
+
+ l = new DigitalOut(pin);
+
+}
+
+void Led::On()
+{
+ l->write(1);
+}
+
+void Led::Off()
+{
+ l->write(0);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led/Led.h Thu Oct 22 10:46:46 2015 +0000
@@ -0,0 +1,19 @@
+#ifndef LED_H
+#define LED_h
+
+#include "mbed.h"
+#include <string>
+
+class Led
+{
+ private:
+ PinName pin;
+ DigitalOut *l;
+
+ public:
+ Led(string s);
+ void On();
+ void Off();
+};
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Oct 22 10:46:46 2015 +0000
@@ -0,0 +1,15 @@
+#include "mbed.h"
+#include "Led.h"
+
+Led red("red");
+
+int main()
+{
+ while(1)
+ {
+ red.On();
+ wait(0.5);
+ red.Off();
+ wait(0.5);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 22 10:46:46 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file