diff --git a/examples/lidar_test.py b/examples/lidar_test.py deleted file mode 100644 index 6547dcc..0000000 --- a/examples/lidar_test.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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() diff --git a/examples/rplidar_simpletest.py b/examples/rplidar_simpletest.py index e69de29..6547dcc 100644 --- a/examples/rplidar_simpletest.py +++ b/examples/rplidar_simpletest.py @@ -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()