How to transmit and recive data by esp32 by uart api.?

#1

I was go through the UART api but i am not able to understand what function is used for what. my sensor has output protocol as [UART; baud rate: 9600, databits: 8, stopbits: 1, parity: no] and for enable auto send we have to transmit 0x680x010x40 and pos ack is 0xA5A5 and negative ack is 0x9696. Also it has a 32 byte protocol length in which byte 6-7 and byte 8-9 is required also byte 30-31 is check sum.
please help me to make the function so that i can read the sensor data.

here is the data sheet.

0 Likes

#2

example-uart-c is a good start.

  • initialize the uart
  • write some functions to send commands
  • in the uart dispatcher process the received data (ack, nack, sensor data, etc) according to the last sent command
  • when the received data meets your conditions, fire a custom event or call a callback to further process it.
1 Like