Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Mon Nov 02 21:34:32 2009 +0000
Commit message:

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 Nov 02 21:34:32 2009 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+
+AnalogIn pot(p16);
+DigitalOut led(LED1);
+
+Serial pc(USBTX,USBRX);
+
+Ticker tick;
+
+
+float Vav=0.0;
+
+void average (void) {
+    led = !led;
+    Vav = (Vav + pot)/2.0;
+}
+
+
+int main() {
+
+    // run the ticker every 100ms
+    tick.attach(&average,0.1);
+
+    while (1) {
+        pc.printf("Average is %.3f\n",Vav);
+        wait (2.0);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 02 21:34:32 2009 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/20a79241b4a0