Sending sensor readings from Arduino to the Pi

I've got an Arduino with a 16x1 multiplexer, with 16 sensors and their readings that are stored in an array and it's connected to the Pi by bluetooth.

Is it possible to send and receive an array to the pi of all theses readings?

My concern is I feel like if I sent these readings over one by one they'd get messed in the buffer waiting to be read by the pi.

Are you so far with this Arduino/Pi integration that you can send a single byte from the Arduino using the serial port, and receive it on the Pi ?

What data type is the array ? If it is not bytes, you can create a union across it so you can view the array as bytes, although there are some risks doing this across platforms where datatypes may not be represented in the same manner.

You can look here for an example of Serial between an Arduino and a Pi using C++ on both sides: Telephone Caller ID Dev Kit - Exhibition / Gallery - Arduino Forum

Have a look at @Power_Broker's Serial Transfer Library
Serial Input Advanced tutorial
SerialTransfer.h

...R

flash_stang:
My concern is I feel like if I sent these readings over one by one they'd get messed in the buffer waiting to be read by the pi.

send all in a packet of information with a fixed format and a way of resynchronizing to the start of the packet.

i've used Type-Length-Value formatted messages.

in your case, you would need only a single type. the length specifies the length of the message.

since you're length should be fixed, you would look for a type with a specific value and a specific length value, otherwise you would reject received bytes until you do.

then read the length of the message containing all your values.

of course you can add addition messages with different type/lengths or variable lengths.

having the message specify the length makes is easier to synchronize because you can reject messages with lengths > limit and if you process the message, there's a limited number of bytes to read.