調整中

Dependencies:   mbed HMC6352 US015 TB6612FNG2 getGPS ATP3011

FrontGet.h

Committer:
user_
Date:
2021-10-27
Revision:
13:38c5ffe5873a
Parent:
6:1cda8471adc3

File content as of revision 13:38c5ffe5873a:

// 障害物の有無を返す関数
#include "us015.h"

US015 hs(D2, D3);
DigitalOut Ultra(D2);

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