ADC TEST CODE of LPC1114FN28

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
iqOyOpi
Date:
Sat Sep 14 00:49:19 2013 +0000
Commit message:
ADC TEST CODE of LPC1114FN28

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	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をオフに
+      }
+    }
+}
+
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Sep 14 00:49:19 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb
\ No newline at end of file