/
pydoc
108 lines (100 loc) · 4.21 KB
/
pydoc
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Help on module hcsr04sensor.sensor in hcsr04sensor:
NAME
hcsr04sensor.sensor
DESCRIPTION
Measure the distance or depth with an HCSR04 Ultrasonic sound
sensor and a Raspberry Pi. Imperial and Metric measurements are available
CLASSES
builtins.object
Measurement
class Measurement(builtins.object)
| Create a measurement using a HC-SR04 Ultrasonic Sensor connected to
| the GPIO pins of a Raspberry Pi.
|
| Metric values are used by default. For imperial values use
| unit='imperial'
| temperature=<Desired temperature in Fahrenheit>
|
| Methods defined here:
|
| __init__(self, trig_pin, echo_pin, temperature=20, unit='metric', gpio_mode=GPIO.BCM)
|
| cuboid_volume(self, depth, width, length)
| Calculate amount of liquid in a cuboid
| (square or rectangle shaped container)
|
| cylinder_volume_side(self, depth, length, radius)
| Calculate the liquid volume of a cylinder on its side
|
| cylinder_volume_standing(self, depth, radius)
| Calculate the liquid volume of a standing cylinder
|
| depth(self, median_reading, hole_depth)
| Calculate the depth of a liquid. hole_depth is the
| distance from the sensor to the bottom of the hole.
|
| depth_imperial(self, median_reading, hole_depth)
| This method is deprecated, use depth method instead.
|
| depth_metric(self, median_reading, hole_depth)
| This method is deprecated, use depth method instead.
|
| distance(self, median_reading)
| Calculate the distance from the sensor to an object.
|
| distance_imperial(self, median_reading)
| This method is deprecated, use distance method instead.
|
| distance_metric(self, median_reading)
| This method is deprecated, use distance method instead.
|
| elliptical_cylinder_volume(self, depth, semi_maj_axis, semi_min_axis)
| Calculate the liquid volume of a standing elliptical cylinder
|
| elliptical_side_cylinder_volume(self, depth, height, width, length)
| Calculate the liquid volume of an elliptical cylinder on its side
|
| raw_distance(self, sample_size=11, sample_wait=0.1)
| Return an error corrected unrounded distance, in cm, of an object
| adjusted for temperature in Celcius. The distance calculated
| is the median value of a sample of `sample_size` readings.
|
|
| Speed of readings is a result of two variables. The sample_size
| per reading and the sample_wait (interval between individual samples).
|
| Example: To use a sample size of 5 instead of 11 will increase the
| speed of your reading but could increase variance in readings;
|
| value = sensor.Measurement(trig_pin, echo_pin)
| r = value.raw_distance(sample_size=5)
|
| Adjusting the interval between individual samples can also
| increase the speed of the reading. Increasing the speed will also
| increase CPU usage. Setting it too low will cause errors. A default
| of sample_wait=0.1 is a good balance between speed and minimizing
| CPU usage. It is also a safe setting that should not cause errors.
|
| e.g.
|
| r = value.raw_distance(sample_wait=0.03)
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| basic_distance(trig_pin, echo_pin, celsius=20)
| Return an unformatted distance in cm's as read directly from
| RPi.GPIO.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
DATA
division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192...
FILE
/home/pi/projects/hcsr04sensor/hcsr04sensor/sensor.py