Home        Store        Learn        Blog

Ping 1D with Ping-python can't connect to Ping Viewer

I am running this on a Raspberry pi using the Ping-python library from your Github. I set the IP address of the pi to and the computer’s to to eliminate the possibility of that being the problem.

So I run the provided sample command sudo python3 simplePingExample.py --device /dev/ttyUSB0 --udp And it reads information from the sonar. But it does the same as the command sudo python3 simplePingExample.py --device /dev/ttyUSB0.

In the code, it stops at the first if statement and skips the udp option I added. To fix this, I added and args.udp is None: to line 24 of the sample script so when there is not udp option, it works without udp. And when the udp option is specified, it goes to the elif and does that code. You have to also add myPing.connect_serial(args.device, args.baudrate) to the elif so it reads from the sonar.

And when I start it now, it gives an error, which I think means it is trying to set up the udp connection.

This is where I don’t know what to do. I can read the data directly from the terminal (without the udp option), but then there is no point in having the Ping Viewer application. Is there anything I can do?

The issue is that the UDP port is a a string, not a number.

do something like myping.connect_udp(host, int(port)) and it should work.

I just reinstalled brping and run the command again and get this error:

And when I do myping.connect_udp(host, int(port)), the ping can’t initialize.

(I have modified the code to ignore errors and continue with the script)


I think the issue is that Ping-viewer expects to find an UDP server (you trying to connect to ping-viewer as if it was the server, while in reality, your code should be it).
Check the code of Ping-proxy. You should bind to a port and wait for a connection.

This works. Thank you. :slight_smile: :smiley:

1 Like