センサ入力例 ロボット製作セミナー演習

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jksoft
Date:
Sat Aug 10 03:13:09 2013 +0000
Commit message:
Rev1

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
diff -r 000000000000 -r 1960122209f8 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Aug 10 03:13:09 2013 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+
+#define SENSOR_NUM  4
+
+AnalogIn floor_sensor[] = { (p15) , (p16) , (p17) , (p18) };
+Serial pc(USBTX, USBRX);
+
+int main() {
+
+    int ain[SENSOR_NUM];
+
+    while(1) {
+        for(int i=0;i<SENSOR_NUM;i++)
+        {
+            ain[i] = floor_sensor[i].read_u16();
+        }
+        pc.printf("[0]:%05d\t[1]:%05d\t[2]:%05d\t[3]:%05d\r\n",ain[0],ain[1],ain[2],ain[3]);
+    }
+}
diff -r 000000000000 -r 1960122209f8 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Aug 10 03:13:09 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e3affc9e7238
\ No newline at end of file