Light detector with simple LDR and LCD display,there exist no calibration

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
christian
Date:
Tue Feb 15 21:24:10 2011 +0000
Commit message:

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
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/TextLCD.lib	Tue Feb 15 21:24:10 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 15 21:24:10 2011 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3
+
+AnalogIn Vin(p20); // 3.3V Vout - 4K7 resistor - pin20 - LDR -100 ohm resistor - GND
+
+ main()
+ {  
+    while(1)  {
+    int x = 0;
+    
+     for (int i=0;i<=100;i++){
+     x = x + 1000*(1-Vin.read()); //build average from 100 values
+     wait (0.01);
+     }
+    x=x/100;
+      lcd.cls();
+      lcd.printf("light intensity\n");
+      lcd.printf("%d\n",x);     //value x is only relative,maybe anybody could calibrate it ? 
+     
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Feb 15 21:24:10 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912