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:0b704ec433ad, committed 2009-11-02
- 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