Home        Store        Learn        Blog

Ping Altimeter simulator script

Hello

I am trying to implement the ping altimeter into my software and I was trying to use the Python simulator to send some sample data over the UDP port. For some reason the following error is returned:

Traceback (most recent call last):
  File "./ping1d-simulation.py", line 162, in <module>
    sim.sendMessage(PING1D_PROFILE)
  File "./ping1d-simulation.py", line 76, in sendMessage
    msg.pack_msg_data()
  File "/home/leon/.local/lib/python2.7/site-packages/brping/pingmessage.py", line 477, in pack_msg_data
    self.msg_data = bytearray(struct.pack(msg_format, *values))
struct.error: argument for 's' must be a string

I am not into Python, but could somebody guide me into the right direction ?

Leon

Hi Leon,

Try with python3, python2 will retire in 9 months.

Hello Patrick,

Thanks, it now runs. What do I have to change to send the UDP packets to another host ?
Sorry, complete Python noob here :slight_smile:
Leon

Hi Patrick, found it, first line duh.
Thanks for your help, data is broadcasting now.

Leon

Hi Leon,

Glad that you figure it out, let us know if you need any further help.