I have used a=ser.write("TEST".encode()) in my code to send data using UART gpio in Rpi. The code shows no error but when I print a,it gives me the length only. Actually i am trying to interface Rpi and Nordic Nrf52832 using UART. I want to send data to nrf from pi.


What return value do you expect instead?

It is normal that a write call returns the number of bytes written, a successful write returns the number of bytes it was supposed to write.

You can use a check similar to this

if (ser.write (data, length) != length)
  // Write not successful
  • Thanks for the info.I basically had a doubt whether data is being transmitted or not. How to check that?
    – M Rafiq
    Jan 22 '19 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.