I am new Python user and I am trying to convert hexadecimal string to decimal integer with Python. In my system, I send analogue values like :
import serial
import binascii
ser = serial.Serial(port = 'COM3',
baudrate = 9600,
bytesize=8,
parity='N',
stopbits=1,
timeout =None) # my parameter to communicate with my card
ser.open()
a = binascii.a2b_hex('010f0001000000c8d9') # transform hexadecimal under binary format (no problem)
u = ser.write(a) # send binary data (no problem, it works fine)
i = ser.read(u) # read the answer
i
# I get that hexadecimal string : '\x02\x01d\x0f\x00\x00\x02\xbf7'
What I tried :
int(i, 0)
it did not work,and I did not find anywhere how I can translate that into a decimal. Does someone know?