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

Dependencies:   TextLCD mbed

Revision:
0:f1db4613080a
--- /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 ? 
+     
+   }
+}