end

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ashchitragar
Date:
Thu Dec 01 08:42:31 2016 +0000
Commit message:
es;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 01 08:42:31 2016 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+ 
+class Flasher {
+public:
+    Flasher(PinName pin) : _pin(pin) {  // _pin(pin) means pass pin to the DigitalOut constructor
+        _pin = 0;                                        // default the output to 0
+    }
+ 
+    void flash(int n) {
+        for(int i=0; i<n*2; i++) {
+            _pin = !_pin;
+            wait(0.2);
+        }
+    }
+ 
+private:
+    DigitalOut _pin;
+};
+ 
+Flasher led(LED2);
+Flasher out(p6);
+ 
+int main() {
+    led.flash(5);
+    led.flash(2);
+    out.flash(10);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Dec 01 08:42:31 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file