Skip to content

Commit

Permalink
Merge pull request #24 from adafruit/adabotify
Browse files Browse the repository at this point in the history
Renamed example to get rid of unnecessary blank file
  • Loading branch information
evaherrada authored Mar 24, 2022
2 parents 5133e6a + 9e0f688 commit d03710f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
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()

0 comments on commit d03710f

Please sign in to comment.