control LED by CdS http://shokai.org/blog/archives/5103

Dependencies:   mbed

Revision:
0:60e8027b95d9
Child:
1:83f0bc743127
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Apr 21 08:32:52 2010 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+DigitalOut led1(LED1);
+DigitalOut led2(p11);
+AnalogIn adc(p15);
+int ain;
+
+int main() {
+    while(1) {
+        if(led1){
+          led1 = 0;
+        }
+        else{
+          led1 = 1;
+        }
+        ain = adc;
+        if(adc < 0.4){
+          led2 = 1;
+        }
+        else{
+          led2 = 0;
+        }
+        pc.printf("%f", (double)adc);
+        pc.printf("\r\n");
+        wait(0.3);
+    }
+}