I am putting together a uint8_t array payload for my xbees and I am reading data from a sensor in a uint8_t array. This array is then copied into the payload with a for loop like this.
ds2438 hum1(&oneWire, TempSerial); //Call sensor
dtostrf(hum1.readHum(),5, 1, dtostrfbuffer); //read humidity(float) into array buffer
humidity_string = dtostrfbuffer; // coppy into a string
for ( int j = 0; j < 6; j++)
payload[9+j] = humidity_string.charAt(j);
The location is always the same and the length of the data is always the same. Is there some way to avoid the for loop here or even the float the string conversion?