Ultimate GPS shield can't run on more than 1hz with MEGA

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

Thank you Rick,

Used your code but still the prints takes between 160 and 185 to compleate :(

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by adafruit_support_rick »

Do you really need to save the parsed GPS data to the logfile? What if you were to save the raw NMEA sentence? That should save quite a bit of time.

To speed up the LCD a little, do't re-print all the labels. For instance, you only need to do these commands once, in setup:

Code: Select all

  lcd.setCursor(0, 0); 
  lcd.print("S"); 
...
  lcd.setCursor(0, 1);
  lcd.print("A ");
...
  lcd.setCursor(0, 2);
  lcd.print("H ");
...
  lcd.setCursor(0, 3);
  lcd.print("Sat ");
If you organize things right, you don't have to print out "MPH", " or "ft", either.

thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

Do you really need to save the parsed GPS data to the logfile? What if you were to save the raw NMEA sentence? That should save quite a bit of time.
I was thinking about that but this is not the best scenario for me since I am adding more data to the log /accelerometer, analog input sensors/ and it will be hard to interpret after the log is made

thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

adafruit_support_rick wrote:
To speed up the LCD a little, do't re-print all the labels. For instance, you only need to do these commands once, in setup:

I did what you suggested and the time dropped to 120 ms but still have to set cursor for each data field or I did not get your idea

Code: Select all

  
  lcd.setCursor(2, 0);
  lcd.print(GPS.speed*1.15078);
  lcd.setCursor(2, 1);
  lcd.print(GPS.altitude);
  lcd.setCursor(2, 2);
  lcd.print(GPS.angle, 0);
  lcd.setCursor(2, 3);
  lcd.print((int)GPS.satellites);

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by adafruit_support_rick »

That's right.

Do you really need to write to the LCD at 10Hz? It can't keep up with that anyway. Maybe write one of the lines every time through, instead of writing all 4.

thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

adafruit_support_rick wrote:That's right.

Do you really need to write to the LCD at 10Hz? It can't keep up with that anyway. Maybe write one of the lines every time through, instead of writing all 4.

no need to write the LCD at 10Hz. In this project the logging is the main funchtion so it has to be at 10 hz. The LCD has informative function so no real need to be at 10Hz

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by adafruit_support_rick »

Here's some thing to try, then. Declare a global variable

Code: Select all

uint8_t lcdLine = 0;
Use it to decide which of the four LCD lines you're going to print on each loop:

Code: Select all

    switch (lcdLine) {
      case 0:
        lcd.setCursor(2, 0);
        lcd.print(GPS.speed*1.15078);
        break;
  
      case 1:
        lcd.setCursor(2, 1);
        lcd.print(GPS.altitude);
        break;
  
      case 2:
        lcd.setCursor(2, 2);
        lcd.print(GPS.angle, 0);
        break;
  
      case 3:
        lcd.setCursor(2, 3);
        lcd.print((int)GPS.satellites);
        break;
        
      default:
        break;

    }
    lcdLine = (lcdLine++ % 4);  //increment lcdLine, but keep in range 0..3

thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

in this case it gets goot time but the LCD refreshes once every about 25 sec

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by adafruit_support_rick »

It should be updating one line each time through. Post the entire sketch.

thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

there it is

Code: Select all

#include <SPI.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <SD.h>
#include <avr/sleep.h>
#include "LiquidCrystal.h"
#include <Wire.h>
   
   LiquidCrystal lcd(3, 2, 4);  
   uint8_t lcdLine = 0;

// Ladyada's logger modified by Bill Greiman to use the SdFat library
//
// This code shows how to listen to the GPS module in an interrupt
// which allows the program to have more 'freedom' - just parse
// when a new NMEA sentence is available! Then access data when
// desired.
//
// Tested and works great with the Adafruit Ultimate GPS Shield
// using MTK33x9 chipset
//    ------> http://www.adafruit.com/products/
// Pick one up today at the Adafruit electronics shop 
// and help support open source hardware & software! -ada

    #define mySerial Serial1

    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  false
/* 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 chipSelect 10
#define ledPin 13

File logfile;

// 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;
}

// blink out an error code
void error(uint8_t errno) {
/*
  if (SD.errorCode()) {
    putstring("SD error: ");
    Serial.print(card.errorCode(), HEX);
    Serial.print(',');
    Serial.println(card.errorData(), HEX);
  }
  */
  while(1) {
    uint8_t i;
    for (i=0; i<errno; i++) {
      digitalWrite(ledPin, HIGH);
      delay(100);
      digitalWrite(ledPin, LOW);
      delay(100);
    }
    for (i=errno; i<10; i++) {
      delay(200);
    }
  }
}

void setup() {
  
     {
     lcd.begin(20, 4);
   }
  // for Leonardos, if you want to debug SD issues, uncomment this line
  // to see serial output
  //while (!Serial);
  
  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  // also spit it out
  Serial.begin(115200);
  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:
  pinMode(10, OUTPUT);
  
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect, 11, 12, 13)) {
  //if (!SD.begin(chipSelect)) {      // if you're using an UNO, you can use this line instead
    Serial.println("Card init. failed!");
    error(2);
  }
  char filename[15];
  strcpy(filename, "GPSLOG00.CSV");
  for (uint8_t i = 0; i < 100; i++) {
    filename[6] = '0' + i/10;
    filename[7] = '0' + i%10;
    // create if does not exist, do not open existing, write, sync after write
    if (! SD.exists(filename)) {
      break;
    }
  }

  logfile = SD.open(filename, FILE_WRITE);
  if( ! logfile ) {
    Serial.print("Couldnt create "); Serial.println(filename);
    error(3);
  }
  Serial.print("Writing to "); Serial.println(filename);
  
      logfile.println("Time,Date,Latitude,Longitude, Elevation,Speed (MPH), Angle,Sat");
  logfile.flush();
  
  // connect to the GPS at the desired rate
  GPS.begin(19200);

  // 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_10HZ);   // 1 or 5 Hz update rate

  // Turn off updates on antenna status, if the firmware permits it
  GPS.sendCommand(PGCMD_NOANTENNA);
  
  Serial.println("Ready!");
    lcd.setCursor(0, 0);
  lcd.print("S");

  lcd.setCursor(0, 1);
  lcd.print("A ");

  lcd.setCursor(0, 2);
  lcd.print("H ");

  lcd.setCursor(0, 3);
  lcd.print("S ");
  
}

void loop() {
   while (mySerial.available()) {
    char c = GPS.read();
    if (GPSECHO)
       if (c)   Serial.print(c);
  }
  
   uint32_t timer = millis();

  // 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;
    }



                       int test;

    Serial.println(test=millis());

      logfile.print(GPS.hour, DEC);
      logfile.print(':');
      logfile.print(GPS.minute, DEC);
      logfile.print(':');
      logfile.print(GPS.seconds, DEC);
      logfile.print('.');
      logfile.print(GPS.milliseconds);
      logfile.print(",");

      logfile.print(GPS.month, DEC); 
      logfile.print('/');
      logfile.print(GPS.day, DEC);
      logfile.print("/20");
      logfile.print(GPS.year, DEC);
      logfile.print(",");

      logfile.print(GPS.latitude, 4);
      logfile.print(GPS.lat);
      logfile.print(",");
      logfile.print(GPS.longitude, 4);
      logfile.print(GPS.lon);
      logfile.print(",");
      logfile.print(GPS.altitude);
      logfile.print(",");
      logfile.print(GPS.speed*1.15078);
      logfile.print(",");
      logfile.print(GPS.angle, 0);
      logfile.print(",");
      logfile.println((int)GPS.satellites);
      logfile.flush();


 Serial.print(GPS.hour, DEC);
    Serial.print(':');
    Serial.print(GPS.minute, DEC);
    Serial.print(':');
    Serial.print(GPS.seconds, DEC);
    Serial.print('.');
    Serial.print(GPS.milliseconds);
    Serial.print(",");

    Serial.print(GPS.month, DEC); 
    Serial.print('/');
    Serial.print(GPS.day, DEC);
    Serial.print("/20");
    Serial.print(GPS.year, DEC);
    Serial.print(",");

    Serial.print(GPS.latitude, 4);
    Serial.print(GPS.lat);
    Serial.print(",");
    Serial.print(GPS.longitude, 4);
    Serial.print(GPS.lon);
    Serial.print(",");
    Serial.print(GPS.altitude);
    Serial.print(",");
    Serial.print(GPS.speed*1.15078);
    Serial.print(",");
    Serial.print(GPS.angle, 0);
    Serial.print(",");
    Serial.println(GPS.satellites);


    switch (lcdLine) {
      case 0:
        lcd.setCursor(2, 0);
        lcd.print(GPS.speed*1.15078);
        break;
 
      case 1:
        lcd.setCursor(2, 1);
        lcd.print(GPS.altitude);
        break;
 
      case 2:
        lcd.setCursor(2, 2);
        lcd.print(GPS.angle, 0);
        break;
 
      case 3:
        lcd.setCursor(2, 3);
        lcd.print((int)GPS.satellites);
        break;
       
      default:
        break;

    }
    lcdLine = (lcdLine++ % 4);  //increment lcdLine, but keep in range 0..3
    
// // lcd.setCursor(0, 0); 
// // lcd.print("S"); 
//  lcd.setCursor(2, 0);
// lcd.print(GPS.speed*1.15078);
////  lcd.print("MPH");
//  lcd.setCursor(2, 1);
////  lcd.print("A ");
//  lcd.print(GPS.altitude);
////  lcd.print("ft");
//  lcd.setCursor(2, 2);
////  lcd.print("H ");
//  lcd.print(GPS.angle, 0);
//  lcd.setCursor(2, 3);
////  lcd.print("Sat ");
//  lcd.print((int)GPS.satellites);
      
   Serial.println(millis()-test);   
      
  }
}


/* End code */
thanks

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by adafruit_support_rick »

Argh! The increment and modulus doesn't work. Do it this way:

Code: Select all

    lcdLine++;
    lcdLine &= 3;  //increment lcdLine, but keep in range 0..3

Here's the code. I'm getting numbers between 57 and 77 from the timer

Code: Select all

#include <SPI.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <SD.h>
#include <avr/sleep.h>
#include "LiquidCrystal.h"
#include <Wire.h>

LiquidCrystal lcd(3, 2, 4);  
uint8_t lcdLine = 0;

// Ladyada's logger modified by Bill Greiman to use the SdFat library
//
// This code shows how to listen to the GPS module in an interrupt
// which allows the program to have more 'freedom' - just parse
// when a new NMEA sentence is available! Then access data when
// desired.
//
// Tested and works great with the Adafruit Ultimate GPS Shield
// using MTK33x9 chipset
//    ------> http://www.adafruit.com/products/
// Pick one up today at the Adafruit electronics shop 
// and help support open source hardware & software! -ada

#define mySerial Serial1

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  false
/* set to true to only log to SD when GPS has a fix, for debugging, keep it false */
#define LOG_FIXONLY true  

// Set the pins used
#define chipSelect 10
#define ledPin 13

File logfile;

// 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;
}

// blink out an error code
void error(uint8_t errno) {
  /*
  if (SD.errorCode()) {
   putstring("SD error: ");
   Serial.print(card.errorCode(), HEX);
   Serial.print(',');
   Serial.println(card.errorData(), HEX);
   }
   */
  while(1) {
    uint8_t i;
    for (i=0; i<errno; i++) {
      digitalWrite(ledPin, HIGH);
      delay(100);
      digitalWrite(ledPin, LOW);
      delay(100);
    }
    for (i=errno; i<10; i++) {
      delay(200);
    }
  }
}

void setup() {

  {
    lcd.begin(20, 4);
  }
  // for Leonardos, if you want to debug SD issues, uncomment this line
  // to see serial output
  //while (!Serial);

  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  // also spit it out
  Serial.begin(115200);
  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:
  pinMode(10, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect, 11, 12, 13)) {
  //  if (!SD.begin(chipSelect)) {      // if you're using an UNO, you can use this line instead
    Serial.println("Card init. failed!");
    error(2);
  }
  char filename[15];
  strcpy(filename, "GPSLOG00.CSV");
  for (uint8_t i = 0; i < 100; i++) {
    filename[6] = '0' + i/10;
    filename[7] = '0' + i%10;
    // create if does not exist, do not open existing, write, sync after write
    if (! SD.exists(filename)) {
      break;
    }
  }

  logfile = SD.open(filename, FILE_WRITE);
  if( ! logfile ) {
    Serial.print("Couldnt create "); 
    Serial.println(filename);
    error(3);
  }
  Serial.print("Writing to "); 
  Serial.println(filename);

  logfile.println("Time,Date,Latitude,Longitude, Elevation,Speed (MPH), Angle,Sat");
  logfile.flush();

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

  // 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_10HZ);   // 1 or 5 Hz update rate

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

  Serial.println("Ready!");
  lcd.setCursor(0, 0);
  lcd.print("S");

  lcd.setCursor(0, 1);
  lcd.print("A ");

  lcd.setCursor(0, 2);
  lcd.print("H ");

  lcd.setCursor(0, 3);
  lcd.print("S ");

}

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

  uint32_t timer = millis();

  // 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;
    }



    int test= millis();

//    Serial.println(test);

    logfile.print(GPS.hour, DEC);
    logfile.print(':');
    logfile.print(GPS.minute, DEC);
    logfile.print(':');
    logfile.print(GPS.seconds, DEC);
    logfile.print('.');
    logfile.print(GPS.milliseconds);
    logfile.print(",");

    logfile.print(GPS.month, DEC); 
    logfile.print('/');
    logfile.print(GPS.day, DEC);
    logfile.print("/20");
    logfile.print(GPS.year, DEC);
    logfile.print(",");

    logfile.print(GPS.latitude, 4);
    logfile.print(GPS.lat);
    logfile.print(",");
    logfile.print(GPS.longitude, 4);
    logfile.print(GPS.lon);
    logfile.print(",");
    logfile.print(GPS.altitude);
    logfile.print(",");
    logfile.print(GPS.speed*1.15078);
    logfile.print(",");
    logfile.print(GPS.angle, 0);
    logfile.print(",");
    logfile.println((int)GPS.satellites);
    logfile.flush();


//    Serial.print(GPS.hour, DEC);
//    Serial.print(':');
//    Serial.print(GPS.minute, DEC);
//    Serial.print(':');
//    Serial.print(GPS.seconds, DEC);
//    Serial.print('.');
//    Serial.print(GPS.milliseconds);
//    Serial.print(",");
//
//    Serial.print(GPS.month, DEC); 
//    Serial.print('/');
//    Serial.print(GPS.day, DEC);
//    Serial.print("/20");
//    Serial.print(GPS.year, DEC);
//    Serial.print(",");
//
//    Serial.print(GPS.latitude, 4);
//    Serial.print(GPS.lat);
//    Serial.print(",");
//    Serial.print(GPS.longitude, 4);
//    Serial.print(GPS.lon);
//    Serial.print(",");
//    Serial.print(GPS.altitude);
//    Serial.print(",");
//    Serial.print(GPS.speed*1.15078);
//    Serial.print(",");
//    Serial.print(GPS.angle, 0);
//    Serial.print(",");
//    Serial.println(GPS.satellites);


    switch (lcdLine) {
    case 0:
      lcd.setCursor(2, 0);
      lcd.print(GPS.speed*1.15078);//Serial.println(GPS.speed*1.15078);
      break;

    case 1:
      lcd.setCursor(2, 1);
      lcd.print(GPS.altitude); //Serial.println(GPS.altitude);
      break;

    case 2:
      lcd.setCursor(2, 2);
      lcd.print(GPS.angle, 0); //Serial.println(GPS.angle, 0);
      break;

    case 3:
      lcd.setCursor(2, 3);
      lcd.print((int)GPS.satellites); //Serial.println((int)GPS.satellites);
      break;

    default:
      break;

    }
    lcdLine++;
    lcdLine &= 3;  //increment lcdLine, but keep in range 0..3

    // // lcd.setCursor(0, 0); 
    // // lcd.print("S"); 
    //  lcd.setCursor(2, 0);
    // lcd.print(GPS.speed*1.15078);
    ////  lcd.print("MPH");
    //  lcd.setCursor(2, 1);
    ////  lcd.print("A ");
    //  lcd.print(GPS.altitude);
    ////  lcd.print("ft");
    //  lcd.setCursor(2, 2);
    ////  lcd.print("H ");
    //  lcd.print(GPS.angle, 0);
    //  lcd.setCursor(2, 3);
    ////  lcd.print("Sat ");
    //  lcd.print((int)GPS.satellites);

    Serial.println(millis()-test);   

  }
}


/* End code */

thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

now is way beter but I am getting between 67 and 93 from the timer
77
84
73
71
79
82
92
67
77
87
74
67
77
83
94
71
77
82
73
68
80
83
96
67
78
83
75
69
80
82
92
any idea how I can shave some more ms from the print's?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by adafruit_support_rick »

thegunman wrote:any idea how I can shave some more ms from the print's?
Nope. But it is even a problem? Check your log - are you missing any GPS reports, or are you getting all 10 per second? If you're not missing anything, then the prints are not a problem.

thegunman
 
Posts: 54
Joined: Mon Jun 09, 2014 7:43 pm

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by thegunman »

at the case you posted I am not missing reports, but I need to print some more data to the screen on the right side /like second coloumn/ and there is at the edge and a lot of times it goes over 100ms and misses line in the log

i simulated data for print justo to check the times, it is static now, but it will be dynamic
102
91
86
95
102
92
109
96
101
92
85
95
103
92
105
95
102
93
88
94
100
111
86
anything to do in order to save some ms with logfile.print's
is SPI the fastest way to print to the LCD?
I2C is taken from the accelerometer on my mega so I can not use it. If I use dyrect connect is it goin go be faster or this woes not matter?

Thanks

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Ultimate GPS shield can't run on more than 1hz with MEGA

Post by adafruit_support_rick »

You can use multiple devices on I2C - it's a bus.

You can try hardware SPI on the Mega. Jumper from 11 to 51, 12 to 50, and 13 to 52. That should cut your time in half.
Change the SD initialization:

Code: Select all

  //if (!SD.begin(chipSelect, 11, 12, 13)) {
    if (!SD.begin(chipSelect)) {      // Use hardware SPI

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”