I am trying to send packets of via bluetooth data that include 6 bytes read from a sensor and stored in a uint8_t array. Instead of sending over the data as numerical digital, I would like to send the ASCII character of each of the bytes. I am doing this to reduce the size of my data packets and make it easier to interpret the incoming data.
uint8_t* temp = readBufferData(FIFO);
for (int i = 0; i < 6; i++)
{
Serial.write(temp[i]);
}
Read buffer data returns a pointer to a uint8_t array read from a FIFO buffer. When I use Serial.print, I get the following output, which makes sense. 22163226094255 One question is, when I use Serial.print on a single character, is it transmitted a single byte, or is it actually sending the decimal digital of the number, anywhere from 1-3 bytes?
When I use the Serial.write, however, I get something like the following DÿÂ?ÁÏ?ÌÆ?Ûµ?˽?ÔÀ?п?ÃÕÓÑËÐTÿÀ?Ï3ÿÉ?¹4ÿÐ?Ê<ÿ½?µfÿ¼?ìNÿÐ?×Â?ÊÚ?׿?Å Also, these data display much more slowly on the screen, than normal.
How can I send each uint8_t value by sending over the corresponding ASCII character for serial transmission?
Thanks!
Serial.print("Hex: 0x"); Serial.print(temp[i],HEX); Serial.print(" - Char: "); Serial.write(temp[i]); Serial.println("");
and then post some of the lines you get