Running Ultrasonic click on UART protocol

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Running Ultrasonic click on UART protocol

Post by scruss » Fri Aug 13, 2021 4:40 pm

Or if you want the objects to be stored as bytes so you don't have to do any conversion, instead of

Code: Select all

buf10= (0x55, 0x0A, 0x26, 0x00, 0xCF)
use

Code: Select all

buf10=b'\x55\x0A\x26\x00\xCF'
That gives you the hex input you need, but represented internally and transmitted as bytes

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: Running Ultrasonic click on UART protocol

Post by Yadnik » Fri Aug 13, 2021 7:36 pm

Thank you scruss,
Even after making all the changes like this:
buf0 = b'\x55\x00\x01\xFE'
buf1 = b'\x55\x01\x01\xFD'
buf5= b'\x55\x05\xFA'
buf10=b'\x55\x0A\x26\x00\xCF'
buf17=b'\x55\x11\x01\xED'
buf19 =b'\x55\x13\x01\xEB'
buf25 = b'\x55\x19\x88\x88\x88\x88\x88\x88b\x84\x21\x08\x42b\x10\x80\x80\x80\x80\x00\x88\x88\x88\x88\x88\x88\x84\x21\x08\x42\x10\x80\x80\x80\x80\x00\x7C'
I am yet getting the same error.Can you please suggest what may be going wrong.

For reference:
My code:https://github.com/Yadnik1/Ultrasonic-C ... %20uart.py
Energia library I am trying to emulate:https://e2e.ti.com/support/sensors-grou ... nd-arduino

Thank you very much!!

Post Reply