# Ping python code problem

**URL:** <https://discuss.bluerobotics.com/t/ping-python-code-problem/15004>\
**Category:** Ping Viewer\
**Tags:** ping\
**Created:** [September 5, 2023, 1:12pm UTC](https://discuss.bluerobotics.com/t/ping-python-code-problem/15004 "2023-09-05T13:12:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZZX](https://avatars.discourse-cdn.com/v4/letter/z/8baadc/32.png) [@ZZX](https://discuss.bluerobotics.com/u/ZZX)\
**Post date:** [September 5, 2023, 1:12pm UTC](https://discuss.bluerobotics.com/t/ping-python-code-problem/15004/1 "2023-09-05T13:12:29Z")

</div>

Hello,

I am new here and this is the first time I use a scanning sonar. I am currently running into some problem with ping360, please help me. I am trying to use the ping-python library provided to gather data for later process.

I would like to scan the area between 66 gradians to 133 gradians (which is a 60 degrees range on the side of the sonar). I tried to use the function ‘control\_auto\_transmit’ and set the start\_angle and stop\_angle, then I realised this function is not yet open to public. Is there another way to set the scanning range?

Also, when I looked at the [ping protocol document](https://docs.bluerobotics.com/ping-protocol/pingmessage-ping360/), it says when operating the sonar’s mode is 1. But when I get device data, it indicates 0. This makes me confused, how can I fix it and will it impact my data output (the binary array)?

This is my code and the device data output. Thank you for looking at my problem!

```auto
Set up Ping360, initialising Ping360 and set transmit frequency, sample period........

for x in range(10):
    output=p.transmitAngle(x)
    print(output)

```

```auto
ID: 2300 - device_data
Header: start_1: 66 start_2: 82 payload_length: 214 message_id: 2300 src_device_id: 2 dst_device_id: 0
Payload:
  - mode: 0
  - gain_setting: 1
  - angle: 0
  - transmit_duration: 32
  - sample_period: 80
  - transmit_frequency: 500
  - number_of_samples: 200
  - data_length: 200
  - data: ['0x83', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xe7', '0xe4', '0xea', '0xf1', '0xe7', '0xe5', '0xed', '0xf8', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xfb', '0xf2', '0xdd', '0xce', '0xcb', '0xc4', '0xc0', '0xb1', '0xac', '0xa7', '0xa1', '0x93', '0x92', '0x99', '0x9f', '0x9d', '0xa6', '0xb1', '0xb4', '0xac', '0xa3', '0x9b', '0x92', '0x94', '0x99', '0x9f', '0x9f', '0x9b', '0x91', '0x8a', '0x79', '0x70', '0x6e', '0x70', '0x6c', '0x62', '0x6a', '0x6b', '0x65', '0x60', '0x61', '0x5e', '0x57', '0x57', '0x49', '0x47', '0x46', '0x44', '0x40', '0x41', '0x40', '0x44', '0x4a', '0x51', '0x50', '0x47', '0x48', '0x46', '0x41', '0x3b', '0x40', '0x49', '0x53', '0x5b', '0x5d', '0x58', '0x52', '0x4e', '0x49', '0x42', '0x3b', '0x36', '0x32', '0x2c', '0x2d', '0x27', '0x28', '0x29', '0x27', '0x26', '0x23', '0x25', '0x25', '0x1e', '0x1c', '0x17', '0x1b', '0x1b', '0x14', '0xb', '0x7', '0x5', '0x8', '0xb', '0xd', '0x13', '0x1b', '0x21', '0x1f', '0x20', '0x22', '0x23', '0x23', '0x24', '0x21', '0x1e', '0x23', '0x26', '0x21', '0x20', '0x20', '0x22']
Checksum: 33362 check: 33362 pass: True, 

```
