Dear all,
I need to create a packet of data in a binary array. Thus, I tried to store a float variable (i.e. temp) into a binary variable (i.e. packet) using a BitMask as follow:
packet[0] = (temp & 0xFF000000) >> 24;
packet[1] = (temp & 0x00FF0000) >> 16;
packet[2] = (temp & 0x0000FF00) >> 8;
packet[3] = (temp & 0x000000FF);
However, I received the following error message:
invalid operands of types 'float' and 'long unsigned int' to binary 'operator&'
packet[0] = (temp & 0xFF000000) >> 24;
^
exit status 1
invalid operands of types 'float' and 'long unsigned int' to binary 'operator&'
Thank you in advance for your help.
I am not familiar with this technique, but I need it to send data throught a LoRa connection.
Best Regards