HI, im trying to get my head round javascript still, ground to a halt again, and it will probably be a really easy thing to resolve, ive tried googling and not had any luck.
I have a serial device that is send battery data, certain parts are binary data others are ascii depenedant on the message and the address, this i have sorted and i have the appropiate channels switching to there resepctive channels.
now to the point, the payload im getting out is a
buffer
[73,81,70,80,84]
, now this is showing as decimal numbers, but if i open the array they are HEX
buffer [5]
0:0x49
1:0x51
2:0x46
3:0x50
4:0x54
so im trying to convert this buffer into a float that should be 13.26
, but if i try to use
msg.payload = Buffer.from(msg.payload,"hex").toString()
return msg;
I get "IQFPT"
, which is the decimal values rather than the hex in the buffer.
like i siad im probably be a dumb arse and its blatantly obvious , but after the fortnight ive had im amazed i can even type.
Thanks in advance