アナログ入力_振動センサ

Dependencies:   TextLCD mbed

振動センサに入力があるとLEDを点灯

参考 https://mbed.org/users/okini3939/notebook/AnalogIn_jp/

Files at this revision

API Documentation at this revision

Comitter:
hasimo
Date:
Wed Jul 23 10:34:13 2014 +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
diff -r 000000000000 -r 18ca468a910f TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Wed Jul 23 10:34:13 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
diff -r 000000000000 -r 18ca468a910f main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 23 10:34:13 2014 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+AnalogIn ain(p15);
+DigitalOut myled(p5);
+
+int main() {
+    float adc, volts;
+    
+    myled = 0;
+    
+    while (1){
+        adc = ain.read();           // read analog as a float
+        volts = adc * 3.3;          // convert to volts
+        if(volts > 1.0){
+            myled = 1;
+        }else{
+            myled = 0;
+        }
+        //wait(0.5);                 //
+    }
+}
diff -r 000000000000 -r 18ca468a910f mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jul 23 10:34:13 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae
\ No newline at end of file