Python Forum
How to convert 4 bytes to an integer ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to convert 4 bytes to an integer ?
#8
Hi Jeff_t,

After I changed the order of the bytes being sent from the slave side "....This time instead of sending [255,15,0,0] from slave, I am sending [0,0,15,255] and on RP, I receive data as....", I also received 4094 by using the struct method too.

But as @bowlofred mentioned, it seems like there is some problem in the data transfer...I also feel the same because I am receiving one set of 4 bytes of data as expected and the next set is very different. Instead, they all should be same and should be equal to 4094 after conversion.

I am trying to figure out what might be the problem, but until now no luck.
Reply


Messages In This Thread
How to convert 4 bytes to an integer ? - by GiggsB - Jan-16-2022, 11:53 PM
RE: How to convert 4 bytes to an integer ? - by GiggsB - Jan-17-2022, 03:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with implementation of the logic to convert roman numeral to integer jagasrik 2 2,352 Aug-14-2020, 07:31 PM
Last Post: deanhystad
  Pack integer values as single bytes in a struct bhdschmidt 3 2,417 Jun-09-2020, 09:23 PM
Last Post: bhdschmidt
  convert from csv row to 16 bit bytes adetheheat 1 1,680 Feb-28-2020, 03:04 PM
Last Post: Larz60+
  8-bit integer to bytes Garitron 1 3,050 Sep-14-2019, 11:22 PM
Last Post: ichabod801
  replace bytes with other byte or bytes BigOldArt 1 10,752 Feb-02-2019, 11:00 PM
Last Post: snippsat
Question [Help] Convert integer to Roman numerals? {Screenshot attached} vanicci 10 9,320 Aug-06-2018, 05:19 PM
Last Post: vanicci
  Convert integer to string Maigol 5 5,602 Mar-05-2018, 10:25 PM
Last Post: python_master89
  cannot convert float infinity to integer error despite rounding off floats Afterdarkreader 3 15,307 Dec-15-2017, 02:01 AM
Last Post: micseydel
  How to convert character to integer in python rajeev1729 2 3,936 Oct-03-2017, 04:30 PM
Last Post: nilamo
  Logic to convert an integer to YEAR / MONTH hugobaur 9 8,061 Oct-18-2016, 11:58 AM
Last Post: hugobaur

Forum Jump:

User Panel Messages

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