by alexis

Files at this revision

API Documentation at this revision

Comitter:
captorsaw
Date:
Mon Jun 18 12:21:18 2012 +0000
Commit message:
led test

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	Mon Jun 18 12:21:18 2012 +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	Mon Jun 18 12:21:18 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479