単輪試験機用測距センサテスト

Dependencies:   mbed

Committer:
manimani3712
Date:
Tue Jan 12 07:39:24 2016 +0000
Revision:
0:8d41a47b4e29
???????????GP2Y0A21YK_test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
manimani3712 0:8d41a47b4e29 1 //sensor_test
manimani3712 0:8d41a47b4e29 2
manimani3712 0:8d41a47b4e29 3 #include "mbed.h"
manimani3712 0:8d41a47b4e29 4
manimani3712 0:8d41a47b4e29 5 AnalogIn sensor(PTB2);
manimani3712 0:8d41a47b4e29 6 Serial pc(USBTX, USBRX);
manimani3712 0:8d41a47b4e29 7
manimani3712 0:8d41a47b4e29 8
manimani3712 0:8d41a47b4e29 9 int main() {
manimani3712 0:8d41a47b4e29 10 float sensor_data;
manimani3712 0:8d41a47b4e29 11 pc.printf("sensortest\n");
manimani3712 0:8d41a47b4e29 12 while(1){
manimani3712 0:8d41a47b4e29 13 sensor_data=sensor.read();//ジャイロ1データの読み込み
manimani3712 0:8d41a47b4e29 14 pc.printf("sensor:%2.5f\n",sensor_data);
manimani3712 0:8d41a47b4e29 15 }//while
manimani3712 0:8d41a47b4e29 16 }//main