Skip to content

Renamed example to get rid of unnecessary blank file #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions examples/lidar_test.py

This file was deleted.

32 changes: 32 additions & 0 deletions examples/rplidar_simpletest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT

from math import floor
from adafruit_rplidar import RPLidar

# Setup the RPLidar
PORT_NAME = "/dev/ttyUSB0"
lidar = RPLidar(None, PORT_NAME, timeout=3)

# used to scale data to fit on the screen
max_distance = 0


def process_data(data):
print(data)


scan_data = [0] * 360

try:
# print(lidar.get_info())
for scan in lidar.iter_scans():
for (_, angle, distance) in scan:
scan_data[min([359, floor(angle)])] = distance
process_data(scan_data)

except KeyboardInterrupt:
print("Stopping.")
lidar.stop()
lidar.disconnect()