Python Forum
[PyQt] Sending 4 bytes Hex data over serial in PyQt
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Sending 4 bytes Hex data over serial in PyQt
#3
Dear Mr. DeaD_EyE,

Thanks for the reply but I am facing another problem. The first two bytes are always the same which are 'a' and 'b' but the rest of the two bytes are user input integers. So each time I would have a different set of integers ranging from 0 to 127. I am really confused on how to combine the first 2 bytes with the rest of the two bytes and send via serial.

I have tried the following ways but it did not help.

1. thirdByte = 100
fourthByte = 120
my_bytestring3 = bytes([hex(ord('a')), hex(ord('b')), hex(thirdByte), hex(fourthByte)])
serial.write(my_bytestring3)

2. thirdByte = 100
fourthByte = 120
my_bytestring2 = bytes([int(a), int(b), thirdByte, fourthByte])
serial.write(my_bytestring2)

Kindly help me in this regard.

Thanks,
gratna
Reply


Messages In This Thread
RE: Sending 4 bytes Hex data over serial in PyQt - by gratna - Oct-28-2019, 03:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Serial Port data readout macellan85 3 7,945 Jun-19-2020, 12:32 PM
Last Post: deanhystad
  Read Data from Serial port PA3040 2 3,010 Feb-25-2020, 04:13 PM
Last Post: Denni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020