回避用のプログラムです。

Dependencies:   mbed TB6612FNG US015

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FrontGet.h Source File

FrontGet.h

00001 #include "us015.h"
00002 
00003 US015 hs(D2, D3);
00004 DigitalOut Ultra(D2);
00005 Serial pc(USBTX,USBRX); 
00006 
00007 int FrontGet() {
00008         Ultra = 1;  //超音波on
00009         hs.TrigerOut();
00010         wait(1);
00011         distance = hs.GetDistance();
00012         pc.printf("distance=%d\r\n", distance);  //距離出力
00013         Ultra=0;//超音波off
00014         return distance;
00015 }