Arduino 如何在使数据可读的同时将GPS数据传输到另一个护罩

Arduino 如何在使数据可读的同时将GPS数据传输到另一个护罩,arduino,i2c,Arduino,I2c,我使用两个Arduino UNOs连接在I2C中。 我正在做一个项目,将GPS数据记录在SD卡上,然后当我的一块板连接到我的网络时,它会打印通过服务器收集的数据。目前,我的GPS数据正在写入GPS板上的SD卡。我遇到的问题是将数据发送到另一块板上的wifi屏蔽,然后将其写入服务器。现在我想绕过GPS屏蔽上的SD卡,将数据直接写入wifi屏蔽上的SD卡。我的代码是来自Ada fruit的示例代码,作为一个不好的程序员,我不知道如何使用我的代码并做到这一点 这是GPS护罩上的代码 #include

我使用两个Arduino UNOs连接在I2C中。 我正在做一个项目,将GPS数据记录在SD卡上,然后当我的一块板连接到我的网络时,它会打印通过服务器收集的数据。目前,我的GPS数据正在写入GPS板上的SD卡。我遇到的问题是将数据发送到另一块板上的wifi屏蔽,然后将其写入服务器。现在我想绕过GPS屏蔽上的SD卡,将数据直接写入wifi屏蔽上的SD卡。我的代码是来自Ada fruit的示例代码,作为一个不好的程序员,我不知道如何使用我的代码并做到这一点

这是GPS护罩上的代码

#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <SD.h>
#include <avr/sleep.h>
#include <GPSconfig.h>
#include <Wire.h>

SoftwareSerial mySerial(8, 6);
Adafruit_GPS GPS(&mySerial);

// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences
#define GPSECHO  true
/* set to true to only log to SD when GPS has a fix, for debugging, keep it false */
#define LOG_FIXONLY false  

// Set the pins used
#define ledPin 13

// read a Hex value and return the decimal equivalent
uint8_t parseHex(char c) {
  if (c < '0')
    return 0;
  if (c <= '9')
    return c - '0';
  if (c < 'A')
    return 0;
  if (c <= 'F')
    return (c - 'A')+10;
  }


void setup() {
  Serial.begin(9600);
  Serial.println("\r\nUltimate GPSlogger Shield");
  pinMode(ledPin, OUTPUT);


  // make sure that the default chip select pin is set to
  // output, even if you don't use it

  // connect to the GPS at the desired rate
  GPS.begin(9600);

  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data)           including altitude
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  // uncomment this line to turn on only the "minimum recommended" data
  //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
  // For logging data, we don't suggest using anything but either RMC only or RMC+GGA
  // to keep the log files at a reasonable size
  // Set the update rate
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 or 5 Hz update rate

  // Turn off updates on antenna status, if the firmware permits it
  GPS.sendCommand(PGCMD_NOANTENNA);

  Serial.println("Ready!");
}

void loop() {
  char c = GPS.read();
  if (GPSECHO)
     if (c)   Serial.print(c);

  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
    // a tricky thing here is if we print the NMEA sentence, or data
    // we end up not listening and catching other sentences! 
    // so be very wary if using OUTPUT_ALLDATA and trying to print out data
    //Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived() flag to   false

    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another

    // Sentence parsed! 
    Serial.println("OK");
    if (LOG_FIXONLY && !GPS.fix) {
        Serial.print("No Fix");
        return;
    }

    // Rad. lets log it!
    Serial.println("Log");

    char *stringptr = GPS.lastNMEA();
    uint8_t stringsize = strlen(stringptr);
    if (stringsize != Wire.write((uint8_t *)stringptr, stringsize))    //write the     string     to the SD file
    if (strstr(stringptr, "RMC"))  
     Serial.println();
   }
 }
#包括
#包括
#包括
#包括
#包括
#包括
软件序列mySerial(8,6);
Adafruit_GPS(和mySerial);
//将GPSECHO设置为“false”,以关闭向串行控制台回显GPS数据
//如果您想调试和收听原始GPS语句,请设置为“true”
#定义GPSECHO true
/*设置为true,仅在GPS有修复时记录到SD,对于调试,将其保留为false*/
#定义LOG_FIXONLY false
//设置使用的引脚
#定义LED引脚13
//读取十六进制值并返回十进制等效值
uint8_t parseHex(字符c){
如果(c<'0')
返回0;

如果(c你有两个并行的SD卡吗?我的意思是,两个屏蔽(GPS和WiFi)堆叠在一起

在你的情况下,字符串通过I2C发送到GPS屏蔽…WiFi屏蔽和Arduino之间的接线如何?你能给我们看一下示意图吗