Serial comunication - possible? AIUTO comunicazione seriale

English: Hi guys, I am writing to explore with you the realization of a project. I already have an Arduino that makes certain functions and makes a log on the SD arduino (Mega2560). I would like this string of log, in addition to being saved nell'sd internal, is transmitted via the serial interface (how? From pins half of communication?) To another Arduino (always equipped with sd) and is saved on this other the device.

I ask you first of all if you can send and receive string in serial, and maybe even use that cable (I thought a simple 3.5mm jack with females on its "arduini" and connected via aux). If possible also references to the codes x sending and reading string. Thank you all in advance, Valerio. :%

Italiano: Salve ragazzi, vi scrivo per valutare insieme a voi la realizzazione di un progetto. Ho gia un arduino che fa determinate funzioni e fa un log sull'sd di arduino (mega2560). Vorrei che questa stringa di log, oltre ad essere salvata nell'sd interna, venga trasmessa via seriale (come? Dai pin 1/2 di comunicazione?) ad un altro arduino (sempre equipaggiato di sd) e venga salvata anche su quest'altro dispositivo.

Vi chiedo inanzitutto se è possibile inviare e ricevere la stringa in seriale, e magari anche che cavo utilizzare (pensavo ad un semplice jack 3.5 con femmine sui relativi "arduini" e collegati tramite aux). Se possibile anche dei riferimenti ai codici x invio e lettura stringa. Ringrazio tutti in anticipo, Valerio. :%

The Arduino Mega 2560 has four serial ports. Any of them can be used to send bytes to another Arduino's serial port.

On the sending side change file.write() or file.print() to Serial2.write() or Serial2.print()..

On the receiving side:

If (Serial.available())
    file.write(Serial.read());

Thanks johnwasser, so i have only to write ALL the string (about 30/40 characters) in the write, plug with a simple jumer the serial port and put in the serial rx of the other arduino? (May i use the jack cable, using only one wire, to pass the information?)

Please, tell me if what i wrote is correct...

And the last question: the string , will be send "all in one" or it trasnfer a byte per cycle, so i have to rebuild the string in rx?

Really really thanks to you.

Valerio.

so i have only to write ALL the string (about 30/40 characters) in the write, Use .write() or .print() exactly as you current use to add data to the local SD card file.

plug with a simple jumer the serial port and put in the serial rx of the other arduino? Connect TX (Pin 1) on the sender to RX (Pin 0) on the receiver and connect Ground to Ground.

(May i use the jack cable, using only one wire, to pass the information?) ? I don't know what you mean by "the jack cable".

the string , will be send "all in one" or it trasnfer a byte per cycle, so i have to rebuild the string in rx? If you are just saving all the data to an SD card file, just save the bytes as they come in. If you want to process each line before saving it you will need a buffer and a way of detecting that you have reached the end of the line.

OKOK, undertood! i don't need a buffer, i will send all the string, perfect! :)

for the "jack cable" i mean the aux cable, jack 3,5mm MALE/MALE

...for ground to ground you mean that i have to connect the GND of the arduino sender to the GND of the arduino receiver?

thanks, man!

VALERiOSPQR:
…for ground to ground you mean that i have to connect the GND of the arduino sender to the GND of the arduino receiver?

Yes.