Skip to content

Commit 9e0f688

Browse files
committed
Renamed example to get rid of unnecessary blank file
1 parent 5133e6a commit 9e0f688

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

examples/lidar_test.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/rplidar_simpletest.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
from math import floor
6+
from adafruit_rplidar import RPLidar
7+
8+
# Setup the RPLidar
9+
PORT_NAME = "/dev/ttyUSB0"
10+
lidar = RPLidar(None, PORT_NAME, timeout=3)
11+
12+
# used to scale data to fit on the screen
13+
max_distance = 0
14+
15+
16+
def process_data(data):
17+
print(data)
18+
19+
20+
scan_data = [0] * 360
21+
22+
try:
23+
# print(lidar.get_info())
24+
for scan in lidar.iter_scans():
25+
for (_, angle, distance) in scan:
26+
scan_data[min([359, floor(angle)])] = distance
27+
process_data(scan_data)
28+
29+
except KeyboardInterrupt:
30+
print("Stopping.")
31+
lidar.stop()
32+
lidar.disconnect()

0 commit comments

Comments
 (0)