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:708a1d284406, committed 2011-01-19
- Comitter:
- hlipka
- Date:
- Wed Jan 19 19:46:05 2011 +0000
- Commit message:
- initial test version
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 Wed Jan 19 19:46:05 2011 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+
+#include "math.h"
+
+/*
+ read the light value from a photo transistor connected to P20 and
+ drive a LCDs LED backlight connected to P25.
+ The backlight should dimm in the dark and brighten up when the lights go on.
+
+ NOTE: the version below doesn't work, remove the printf in line 35!
+*/
+int main() {
+ DigitalOut led1(LED1);
+ float f=0.0;
+ PwmOut display(p25);
+ display.period_ms(1);
+ display=f;
+
+ AnalogIn light(p20);
+
+ for (int i=0;i<100;i++)
+ {
+ f=f+0.01;
+ display=f;
+ wait (0.03);
+ }
+ printf("%f\n",display.read());
+ led1=1;
+
+ while (true)
+ {
+ double d=light;
+ double sq=pow(d,0.6);
+ display.write(sq*3);
+ printf("%f / %f\n",d,sq);
+ wait(1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 19 19:46:05 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e