Skip to content

Commit c211f43

Browse files
committedJul 25, 2017
updated readme with example
1 parent ac4b163 commit c211f43

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed
 

‎README.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Sweep for Processing [![Build Status](https://travis-ci.org/cansik/sweep-processing.svg?branch=master)](https://travis-ci.org/cansik/sweep-processing) [![Build status](https://ci.appveyor.com/api/projects/status/2w9xm1dbafbi7xc0?svg=true)](https://ci.appveyor.com/project/cansik/sweep-processing) [![codebeat badge](https://codebeat.co/badges/3d8634b7-84eb-410c-b92b-24bf6875d8ef)](https://codebeat.co/projects/github-com-cansik-sweep-processing-master)
2-
Use the scanse sweep lidar with processing.
2+
Use the Scanse Sweep LIDAR with processing.
33

44
## Introduction
55

@@ -9,4 +9,39 @@ Currently it is still under development and is **ONLY** tested on MacOS.
99

1010
![LIDAR Example](readme/lidar-example.png)
1111

12-
*Example of the LIDAR with FX2D*
12+
*Example of the LIDAR with FX2D*
13+
14+
## Example
15+
To simply get sample data from the LIDAR sensor, you have to create a new `SweepSensor` and call the `start` mehtod. The start method needs the path to the Sweep COM port.
16+
17+
```java
18+
import ch.bildspur.sweep.*;
19+
20+
SweepSensor sweep;
21+
22+
void setup()
23+
{
24+
size(600, 300, FX2D);
25+
26+
sweep = new SweepSensor(this);
27+
sweep.start("/dev/tty.usbserial-DO004HM4");
28+
}
29+
```
30+
31+
In draw you then just have to read the new samples from the device.
32+
33+
```java
34+
void draw()
35+
{
36+
// do your stuff
37+
38+
// read samples
39+
List<SensorSample> samples = sweep.getSamples()
40+
41+
// do drawing
42+
}
43+
```
44+
45+
It is recommended to save the reference to the list of samples in a own variable and only use `getSamples()` once in a draw loop. Otherwise it is not guaranteed, that the samples are from the same scan (Concurrency).
46+
47+
*Based on [BasicExample](examples/BasicExample/BasicExample.pde)*

‎readme/lidar-example.png

-8.72 KB
Loading

0 commit comments

Comments
 (0)