final_8조 / Mbed OS Line-Tracking

Dependencies:   WS2812 PixelArray Adafruit_GFX

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hcsr04.h Source File

hcsr04.h

00001 #ifndef hcsr04_H
00002 #define hcsr04_H
00003 #include "mbed.h"
00004 
00005 
00006  
00007 class HCSR04 {
00008   public:
00009     HCSR04(PinName t, PinName e, RawSerial pc, int flag, int limit);
00010     long echo_duration();
00011     void distance();
00012     void Trig();
00013     long returndistance();
00014     
00015     /*void setMode(bool mode);
00016     int getStatus();
00017     void clearStatus();*/
00018     int flag;
00019  
00020     private:
00021         /*bool _repeat;
00022         float _interval;
00023         int _done;*/
00024         DigitalOut trig;
00025         DigitalIn echo;
00026         RawSerial _pc;
00027         Timer timer;
00028         long duration; 
00029         int distance_cm;
00030         int _limit;
00031 };
00032  
00033 #endif