-
Notifications
You must be signed in to change notification settings - Fork 2
/
HCSR04.h
43 lines (32 loc) · 932 Bytes
/
HCSR04.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
HCSR04.h - Library for sensor HCSR04
*/
#ifndef HCSR04_h
#define HCSR04_h
#include <Arduino.h>
class HCSR04
{
public:
HCSR04(int Trigger,int Echo);
/*!
@method
@abstract Sets all the pins of the device.
@discussion This method sets all the pins of the device Trigger
and Echo.
@param Trigger[in] device pin to send pulses. Range (0..12).
@param Echo[out] to set the pin of answer device (0..12).
*/
float ping(int Divider, int shift);
/*!
@method
@abstract Starts calculating a distance.
@discussion This method use this Formula: delay in uS / 58 = centimeters.
@param Divider[integer] divider of the formula (0..32,767).
@para shift[integer] offset at distance null.
@result Divider = 58; offset = 0 answer distance in centimeters
*/
private:
int _Trigger;
int _Echo;
};
#endif