TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: erich on November 08, 2014, 01:30:34 PM

Title: USing GPS and Accelerometer together
Post by: erich on November 08, 2014, 01:30:34 PM
Hi,
I have been trying to use the accelerometer and GPS together.  I am following the examples for GPS and Accelerometer. I am using Software Serial and Wire. However I find amalgamating the two examples the code continually restarts like there is a conflict between the two libraries. Though I have trimmed out a lot of GPS code to make the sketch smaller.
I notice there was previous topic with a conflict GPS and wifi,. Could there be a similar issue here?
Title: Re: USing GPS and Accelerometer together
Post by: bowden100 on November 13, 2014, 10:43:39 PM
Hi,
I have been trying to use the accelerometer and GPS together.  I am following the examples for GPS and Accelerometer. I am using Software Serial and Wire. However I find amalgamating the two examples the code continually restarts like there is a conflict between the two libraries. Though I have trimmed out a lot of GPS code to make the sketch smaller.
I notice there was previous topic with a conflict GPS and wifi,. Could there be a similar issue here?

If you want want them to work together, you have to read all the data from the GPS and then read you can read the data from the Accelerator chip...

So for example:

void loop()
{
       //give me time in ms
       uint16_t slice = millis() % 1000;

      // read the acc data every 100ms
      if (slice % 100) <= 1)
        read_acc_data();

      // this will occur every second with data
      while (gps_serial.available() > 0)
      {  byte data= gps_serial.read();
          ....
      }

}

There is this library code called TinyGPS++ that work with this and has some good examples on
how to use the GPS...there is also a CAT logger program that works with the GPS as well.
That is a good place to start with the GPS.

The GPS does work with the accelerator chip but it does not work with classic blue toothe..
the blue toothe signal drowns out the GPS signal. The GPS signal does have to be outside
though for it to work.