I'll preface this by saying I'm a mechanical engineer who's been asked to build a device and also look at the programming, the mechanical bit is easy, I'm struggling a little with some of the programming;
I'm using a Nano R4 and LoRa wan shield to send some data to a "things" server, I've pulled in the demo code and got the whole thing working, I can send data and it appears okay in the things server.
I could do with some help understanding how a section of the code works;
int randomNumberOne = 99;
int randomNumberTwo = 11;
Serial.print(F("Random Number 1: "));
Serial.println(randomNumberOne);
Serial.print(F("Random Number 2: "));
Serial.println(randomNumberTwo);
char sensor_data_buff[128] = "\0";
snprintf(sensor_data_buff, 128, "AT+SENDB=%d,%d,%d,%02X%02X%02X%02X", 0, 2, 4, (short)(randomNumberOne*100)>>8 & 0xFF, (short)(randomNumberOne*100) & 0xFF, (short)(randomNumberTwo*10)>>8 & 0xFF, (short)(randomNumberTwo*10) & 0xFF);
"randomnumberone" and "randomnumbertwo" are integers that represent real life data.
I understand that snprintf takes everything and converts it to a string.
I don't understand how its turning the integers into hex, specifically this bit;
(short)(randomNumberOne*100)>>8 & 0xFF, (short)(randomNumberOne*100) & 0xFF, (short)(randomNumberTwo*10)>>8 & 0xFF, (short)(randomNumberTwo*10) & 0xFF);
for random values 99 and 11, the returned hex data in sensor_data_buff is 26AC006E, I can't understand how to break the hex down, in order to convert it back to decimal.