File tree Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,11 @@ To install in a virtual environment in your current project:
53
53
source .env/bin/activate
54
54
pip3 install adafruit-circuitpython-lidarlite
55
55
56
- Usage Example
57
- =============
56
+ Usage Examples
57
+ ==============
58
+
59
+ V3 Example
60
+ ----------
58
61
59
62
.. code-block :: python
60
63
@@ -78,6 +81,43 @@ Usage Example
78
81
print (e)
79
82
time.sleep(0.01 ) # you can remove this for ultra-fast measurements!
80
83
84
+
85
+ V3 HP Example
86
+ -------------
87
+
88
+ .. code-block :: python
89
+
90
+ import time
91
+ import busio
92
+ import board
93
+ import adafruit_lidarlite
94
+
95
+ i2c = busio.I2C(board.SCL , board.SDA )
96
+
97
+ sensor = adafruit_lidarlite.LIDARLite(i2c, sensor_type = adafruit_lidarlite.TYPE_V3HP )
98
+
99
+ while True :
100
+ try :
101
+ print (f " Sensor ID#: { sensor.unit_id} " )
102
+ print (f " Distance = { sensor.distance} " )
103
+ print (f " Strength: { sensor.signal_strength} " )
104
+ except RuntimeError as e:
105
+ print (e)
106
+ try :
107
+ print (f " Status: 0b { sensor.status:b } " )
108
+ print (f " Busy: { bool (sensor.status & adafruit_lidarlite.STATUS_BUSY_V3HP )} " )
109
+ print (f " Overflow: { bool (sensor.status & adafruit_lidarlite.STATUS_SIGNAL_OVERFLOW_V3HP )} " )
110
+ print (f " Health: 0b { sensor.health_status:b } " )
111
+ print (f " Power Control: 0b { sensor.power_control:b } " )
112
+ print (f " I2C Config: 0b { sensor.i2c_config:b } " )
113
+ print (f " Test Command: 0b { sensor.test_command:b } " )
114
+ print (f " Correlation: 0b { sensor.correlation_data} " )
115
+ except RuntimeError as e:
116
+ print (e)
117
+
118
+ print ()
119
+ time.sleep(1 )
120
+
81
121
Documentation
82
122
=============
83
123
You can’t perform that action at this time.
0 commit comments