I would like to send data from arduino A to another arduino B. The arduino A has to send about 5 float values to the arduino B. What would be the most efficient way to do that?
I was thinking about using I2C bus, but I have to mention that each arduino is already connected to a screen using analog A4 and A5 pins with I2C bus. Their loop frequency is around 1Hz because screens use much ressource.
I'm feeling that this is going to be a guessing game where we give options, and you tick them off by saying "doesn't work because..."
So let's do it differently: what's your project about, what is the underlying reason for needing to exchange float values between Arduino's and what kind of circuit is this actually (please show a schematic)?
sorry I forgot to mention, it's two Arduino Nano. I didn't know that Arduinos have more than one serial port.
Yes, data flow is unidirectional, from A to B
The Mega has 4 uarts of which one is used for USB. Leonardo, Micro and Nano Every (and there are more) have one serial port but it's not used for the USB so can be used without interfering with the PC communication.
SERIAL!
For the amount of data you want to send serial is an excellent choice!
Plus if you want to debug it you can always use a PC serial port as a sniffer using something uniterm of putty.
PLUS is you want to have more than TWO arduino's (uC) you can loop daisy chain them such:
Atx->Brx->Btx->Crx->Ctx-Arx etc blah.
What you do then is add a device ID to the header of the message eg:
FromA ToC thus when B rx's the message it just ignores it and passes in through.
Then when C Rx's the message it tags an ACK on the end and sends it back to A.
I am planning a multi uC robot and i will use a protocol like this, also if uC are co-located you can run Serial at high speed or like a meteo device i have the Arduino is a back of house 18m meters from PC running it Half Duplex at 9600 Bits Per Second faultlessly.
Opss forgot to mention when you serial this way be mindful of the signal wiring to avoid crosstalk.
I use ribbon { 0V, Tx, Vcc (or 0V), Rx } that way the every other GND SIGNAL avoid getting Tx data back into your Rx.
Whilst some Arduinos may have only one hardware serial port, you can normally add software serial ports to use GPSs, communicate with other Arduinos etc.
damn guys, that makes a lot of answers! I will try out your suggestions, especially the SoftwareSerial library and will come back afterwards. Thank you a lot