I am receiving HEX Char using IM920 Radio module;
but my problem is receiving data:
Receive-1: 00,0921 // here 1st two characters are ID, Next 4 characters are temp value.
Receive-2: 01,1AB8// here 1st two characters are id, next 4 characters are humidity value.
Receive-3: 02,1256FB// here 1st two charecter are id, next 6 charecter are humidity percentage value.
anyone help me how I put them in different array [id][temp][humidity][humidityper]?
thanks in advance
You can create an array of structure with just 1 dimension.
struct MyStruct {
char ID;
int16_t temp;
int16_t humidity;
int16_t humidityper;
};
MyStruct array[100];
You will obtain an array for 100 items with MyStruct each.
In the transmitter, I’d take all 4 values (ID, TEMP, HUMID, HUMID%) and load them into an appropriately-sized struct. Then send the whole thing at once in binary format.
At the receive, transfer the received binary data into an identically-defined struct. The original values will now be in their proper struct fields.
Dear Budvar10,
thanks for your replay, by Array how i put my value in the array?
nayeenalamin:
Dear Budvar10,
thanks for your replay, by Array how i put my value in the array?
Send and receive a MyStruct variable and the values will automatically be in the correct fields. Then just transfer them to the proper element in the array of structs.