When dealing with sensor data in hexadecimal format like '450934644ad7a38441', I need to extract the last 8 characters which represent the temperature value and convert it into a readable number. I attempted using an online hex converter tool from .
The conversion on this website suggests that the desired number falls under the Float - Little Endian (DCBA) system, while another UINT32 - Big Endian (ABCD) system is used for the process.
I am struggling to convert this number into float as parseFloat() results in NaN. Any guidance would be greatly appreciated.
var data = '450934644ad7a38441';
function main(data) {
var result = [
{
"key": "temperature",
"value": parseInt('0x'+data.substring(10))
}
]
return result;
}
console.log(main(data));
// expected output: Array [Object { key: "temperature", value: 16.58 }]