You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-22Lines changed: 64 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -3,23 +3,23 @@ Arduino Library for Scanse Sweep LiDAR
3
3
4
4
# Compatibility
5
5
### Arduino
6
-
Currently the library has only been tested with an `Arduino Mega 2560`.
6
+
Currently the library has only been tested with an `Arduino Mega 2560`, an `Arduino Mega ADK`, and an `Arduino Micro`.
7
+
7
8
### Sweep Firmware
8
9
| sweep firmware | compatibility |
9
10
| :------------: | :-----------: |
10
11
| > v1.4 | untested |
11
12
| v1.4 | yes |
12
13
13
-
The library is designed to support recent Sweep firmware versions. The communication protocol used by the earlier firmwares may not work properly with this library. You can download the latest firmware [here](http://scanse.io/downloads).
14
+
The library is designed to support the most recent Sweep firmware version. The communication protocol used by earlier firmware versions may not work properly with this library. A guide to updating the Sweep's firmware is available [here](https://support.scanse.io/hc/en-us/articles/224557908-Upgrading-Firmware).
14
15
15
16
# Installation
16
17
Copy the entire `Sweep/` folder to your `.../Arduino/libraries/` directory.
17
18
18
19
# Use
19
-
20
20
Checkout the provided `Examples/` directory for 2 full examples.
21
21
22
-
For best results, you should provide dedicated external 5V power to the Sweep rather than using power from the Arduino. Just be sure to connect the ground from the power source and the arduino. If you are just experimenting, you can run the sweep off the 5V power from the Arduino with the Arduino receiving power over USB. However this has only been tested with an external powered USB hub. It is possible that using a low power USB port (ex: laptop) to power the arduino + sweep will result in unexpected behavior.
22
+
For best results, you should provide dedicated external 5V power to the Sweep rather than using power from the Arduino. Just be sure to connect the ground from the power source and the arduino. If you are just experimenting, you can run the sweep off the 5V power from the Arduino with the Arduino receiving power over USB. However, it is possible that using a low power USB port (ex: laptop) to power the arduino + sweep will result in unexpected behavior.
Constructs a sweep device on the provided Stream object.
98
101
99
102
```c++
100
-
boolbIsScanning
103
+
boolisScanning()
101
104
```
102
105
103
-
True if the device is currently scanning.
106
+
Returns true if the device is currently scanning.
104
107
105
108
```c++
106
109
bool startScanning()
@@ -118,22 +121,16 @@ bool stopScanning()
118
121
Signals the sweep device to stop scanning. Will block for ~500ms to flush leftover data stream from the buffer and validate a second response from the sensor.
119
122
120
123
```c++
121
-
bool getReading(ScanPacket &reading)
124
+
ScanPacket getReading(bool &success)
122
125
```
123
126
124
127
Reads a single sensor reading from the serial buffer. Must be called frequently enough to keep up with the data stream.
125
128
126
129
```c++
127
-
struct ScanPacket
128
-
{
129
-
bool bIsSync; // 1 -> first reading of new scan, 0 otherwise
130
-
float angle; // degrees
131
-
uint16_t distance; // cm
132
-
uint8_t signalStrength; // 0:255, higher is better
133
-
}
130
+
class ScanPacket
134
131
```
135
132
136
-
Structure representing a single sensor reading (ranging). ie: a full 360deg scan would be composed of many such readings.
133
+
Class representing a single sensor reading (ranging). ie: a full 360deg scan would be composed of many such readings.
137
134
138
135
```c++
139
136
boolgetMotorReady()
@@ -158,6 +155,7 @@ Returns the current motor speed setting in HZ
Resets the device. Attempting to communicate with the device while it is resetting will cause issues. While the device is booting the LED on the device will blink green. The device is capable of communication when the LED turns from green to blue, although the motor may still be adjusting until the blue LED stops blinking as well.
Constructs a ScanPacket object with the given parameters. The construction of the ScanPacket object for a reading is handled by the Sweep class's getReading() method; you should not need to use this constructor.
206
+
207
+
```c++
208
+
bool isSync() const
209
+
```
210
+
211
+
Returns true if this reading was the first reading of a new scan; otherwise, returns false.
212
+
213
+
```c++
214
+
floatgetAngleDegrees() const
215
+
```
216
+
217
+
Returns the angle of this reading as a float, in degrees.
201
218
219
+
```c++
220
+
uint16_t getAngleRaw() const
221
+
```
222
+
223
+
Returns the angle of this reading as the raw 16-bit fixed point value. The scaling factor of this value is 16; this means that the angle in degrees is obtained by dividing the raw value by 16.
224
+
225
+
```c++
226
+
uint16_tgetDistance() const
227
+
```
228
+
229
+
Returns the distance of this reading, in centimeters.
230
+
231
+
```c++
232
+
uint8_t getSignalStrength() const
233
+
```
234
+
235
+
Returns the signal strength of this reading as an integer value between 0 and 255. Signal strength can be thought of as a confidence metric. A low value indicates low strength, and a high value indicates high strength.
236
+
237
+
> **Note:** The signal strenth value is affected by light conditions, material properties etc. For more information, see the article on the [Theory of Operation](https://support.scanse.io/hc/en-us/articles/115006333327-Theory-of-Operation).
238
+
239
+
```c++
240
+
floatgetNormalizedSignalStrength() const
241
+
```
202
242
243
+
Returns the signal strength of this reading as a float value normalized between 0 and 1. ie: ints [0:255] map to floats [0.0f:1.0f].
244
+
> **Note:** this method only normalizes a raw byte value. It does NOT normalize the signal strength of this reading in the context of the min and max signal strengths from all readings in a scan, as the reading class has no knowledge of a scan.
0 commit comments