1

First, I am a beginner... My code is:

data = bytearray(b'\x01\x04\x00\x16\x00\x02\x00\xf9')

# 1 - does not work as expected:
ser.write(serial.to_bytes(data))
    
# 2 - works as expected:
ser.write(serial.to_bytes([0x01,0x04,0x00,0x16,0x00,0x02,0x90,0x0f]))

So, what am I missing? I need to have the same results as in 2 but loading the data from a bytearray.

1
  • Although I have fixed the bytearray, still does not work. So the question still there... Commented Oct 3, 2021 at 16:04

1 Answer 1

1

Reading my own post I found the answer: The last two bytes are flipped.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.