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

Dependencies:   mbed TB6612FNG US015

FrontGet.h

Committer:
ushiroji
Date:
6 months ago
Revision:
0:92fbe3130656

File content as of revision 0:92fbe3130656:

#include "us015.h"

US015 hs(D2, D3);
DigitalOut Ultra(D2);
Serial pc(USBTX,USBRX); 

int FrontGet() {
        Ultra = 1;  //超音波on
        hs.TrigerOut();
        wait(1);
        distance = hs.GetDistance();
        pc.printf("distance=%d\r\n", distance);  //距離出力
        Ultra=0;//超音波off
        return distance;
}