Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WS2812 PixelArray Adafruit_GFX
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
Generated on Sun Jul 17 2022 05:22:18 by
1.7.2