ADC TEST CODE of LPC1114FN28

Dependencies:   mbed

Revision:
0:87a098bea248
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Sep 14 00:49:19 2013 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+float threshold =   0.5;  // 閾値
+float val;
+AnalogIn Val(dp13);     // ポテンショメータのワイプ(中央の端子)に
+                        // 両端はグランドと+5Vに接続
+DigitalOut myled(LED1);
+Serial pc(dp16,dp15);
+
+int main() {
+    pc.baud(115200);
+    pc.printf("LPC1114 demo ADC\r\n");
+    
+    while(1){
+      val = Val;
+      pc.printf("Val = %2.1f\r\n", val);
+      if (val >= threshold) {
+        myled = 1;   // LEDをオンに
+      } else {
+        myled = 0;   // LEDをオフに
+      }
+    }
+}
+
+