ایا با این کد می شه اطلاعات جی پی ا سرو از اردینوی مستر به اردینو اسلیو انتقا ل داد ؟؟؟؟؟؟


کد :

#include <SoftwareSerial.h>

SoftwareSerial gpsSerial(10, 11); // RX, TX (TX not used)
const int sentenceSize = 80;

char sentence[sentenceSize];
#include <Wire.h>
void setup()
{
Serial.begin(9600);
gpsSerial.begin(9600);
Wire.begin();
}
byte x = 0;
void loop()
{
static int i = 0;
if (gpsSerial.available())
{
char ch = gpsSerial.read();
if (ch != '\n' && i < sentenceSize)
{
sentence[i] = ch;
i++;
}
else
{
sentence[i] = '\0';
i = 0;
displayGPS();
}
}
}

void displayGPS()
{
char field[20];
getField(field, 0);
if (strcmp(field, "$GPRMC") == 0)
{
Serial.print("Lat: ");
getField(field, 3); // number
Serial.print(field);
getField(field, 4); // N/S
Serial.print(field);

Serial.print(" Long: ");
getField(field, 5); // number
Serial.print(field);
getField(field, 6); // E/W
Serial.println(field);

Wire.beginTransmission(4); // transmit to device #4
Wire.write("x is "); // sends five bytes
Wire.write(field); // sends one byte
Wire.endTransmission(); // stop transmitting

x++;
delay(500);
}

}

void getField(char* buffer, int index)
{
int sentencePos = 0;
int fieldPos = 0;
int commaCount = 0;
while (sentencePos < sentenceSize)
{
if (sentence[sentencePos] == ',')
{
commaCount ++;
sentencePos ++;
}
if (commaCount == index)
{
buffer[fieldPos] = sentence[sentencePos];
fieldPos ++;
}
sentencePos ++;
}
buffer[fieldPos] = '\0';
}


چه تغییری باید د راین کد داد ؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟