Created
September 18, 2026 11:36
-
-
Save patrickelectric/e1b9eb0ad694f625f3f59159b0437154 to your computer and use it in GitHub Desktop.
Test navigator V3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S uv run --script | |
| # /// script | |
| # requires-python = ">=3.9" | |
| # dependencies = ["bluerobotics_navigator>=0.2.0"] | |
| # /// | |
| import os | |
| import platform | |
| import bluerobotics_navigator as navigator | |
| from bluerobotics_navigator import AdcChannel, NavigatorVersion, Raspberry, UserLed | |
| def navigator_check(): | |
| print(f"Functions available: {navigator.__all__}") | |
| if os.environ.get("CI") == "true": | |
| print("Running in CI") | |
| print("Not possible to test navigator sensors yet.") | |
| return | |
| print("Initializing navigator module.") | |
| navigator.set_rgb_led_strip_size(1) | |
| navigator.set_navigator_version(NavigatorVersion.Version3) | |
| if platform.machine() == "aarch64": | |
| navigator.set_raspberry_pi_version(Raspberry.Pi5) | |
| navigator.init() | |
| print("Setting led on!") | |
| navigator.set_led(UserLed.Led1, True) | |
| print(f"Temperature: {navigator.read_temp()}") | |
| print(f"Pressure: {navigator.read_pressure()}") | |
| print(f"Leak sensor: {navigator.read_leak()}") | |
| Data = navigator.read_adc_all() | |
| print( | |
| f"Data ADC Channels: 1 = {Data[0]}, 2 = {Data[1]}, 3 = {Data[2]}, 4 = {Data[3]}" | |
| ) | |
| print(f"Data ADC Channel: 1 = {navigator.read_adc(AdcChannel.Ch1)}") | |
| Data = navigator.read_mag() | |
| print(f"Magnetic field: X = {Data.x}, Y = {Data.y}, Z = {Data.z}") | |
| Data = navigator.read_accel() | |
| print(f"Acceleration: X = {Data.x}, Y = {Data.y}, Z = {Data.z}") | |
| Data = navigator.read_gyro() | |
| print(f"Gyroscope: X = {Data.x}, Y = {Data.y}, Z = {Data.z}") | |
| print("Setting led off!") | |
| navigator.set_led(UserLed.Led1, False) | |
| if __name__ == "__main__": | |
| navigator_check() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment