I am trying to run simplePingExample.py for " Ping Sonar Altimeter and Echosounder " on Linux PC but it doesn’t want to run and this error is appear:
Traceback (most recent call last):
File “simplePingExample.py”, line 4, in
from brping import Ping1D
File “/home/ahmed/.local/lib/python2.7/site-packages/brping/init.py”, line 4, in
from brping.device import PingDevice
File “/home/ahmed/.local/lib/python2.7/site-packages/brping/device.py”, line 38
def connect_serial(self, device_name: str, baudrate: int =115200):
^
SyntaxError: invalid syntax
Hi,
I am facing an issue with the simplePingExample.py.
Opening /dev/ttyUSB0 at 115200 bps
Traceback (most recent call last):
File “/home/i4mt/ping-python/brping/device.py”, line 50, in connect_serial
self.iodev.send_break()
File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 701, in send_break
termios.tcsendbreak(self.fd, int(duration / 0.25))
termios.error: (32, ‘Broken pipe’)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/i4mt/ping-python/echo.py”, line 4, in
myPing.connect_serial(“/dev/ttyUSB0”, 115200)
File “/home/i4mt/ping-python/brping/device.py”, line 55, in connect_serial
raise Exception(“Failed to open the given serial port: {0}”.format(exception))
Exception: Failed to open the given serial port: (32, ‘Broken pipe’)
This is the error i get while running the code. I am running the code on raspberrypi 5 with raspbian os. The echosounder is working well because i have checked it using the ping-viewer. But on linux, it is not even opening the port. I enabled the Serial port permission on sudo raspi-config, added user permission for /dev/ttyUSB0, tried using raspberrypi 4, tried in a ubuntu system, tried using screen for monitoring the serial data but came out as a blank screen. Same problem persists.
please help!