Altimeter data read

Hi,

I am trying to read data from Ping Sonar Altimeter and Echosounder with this code
But when I run it it gives an error.

(host, port) = args.udp.split(',')

ValueError: not enough values to unpack (expected 2, got 1)

I have connected the altimeter directly to Raspberry Pi with UART.

How can I fix that?

Thanks!

I change that line myPing.connect_udp(host, port) to myPing.connect_udp("192.168.2.2", 9090) and its working now.

Is that from your code? There’s no line like that in the code example you linked to.

The actual code in the example is

(host, port) = args.udp.split(':')

which is used to convert a program command-line argument like --udp 192.168.2.2:9090 into a host IP and port number.

Hard-coding the values also works (as you’ve found), although it’s less versatile if you later decide to change the IP address or port.