Communication idea need.

Hello all.

I need good idea. In my project i have 2 board (UNO named Slave1, Slave2 )interfacing to NMEA 0183 device (GPS reciver) and master (UNO named MASTER)board with SD CARD, LCD display and serial output to ROBOTEQ controller.

I need to pass data from Slave1 or Slave2 to Master.

I can extract latitude and longitude with TinyGPS++ library, but its impossible to store and transfer over I2C bus double class variables values cause i have lost of precision.

May be somebody have good solution for this trouble?

but its impossible to store and transfer over I2C bus double class variables values cause i have lost of precision.

A union will solve the variable issue... take a look at how the RF12B library manages to send data over packet radio:

Example from Digispark:

union
{
    unsigned char byte;
    struct
    {
char ATS_RSSI:
        1;  //ATS=Antenna tuning circuit detected strong enough RF signal
        //RSSI=The strength of the incoming signal is above the pre-programmed limit
char FFEM:
        1;      //FIFO is empty
char LBD:
        1;          //Low battery detect, the power supply voltage is below the pre-programmed limit
char EXT:
        1;          //Logic level on interrupt pin (pin 16) changed to low (Cleared after Status Read Command)
char WKUP:
        1;      //Wake-up timer overflow (Cleared after Status Read Command )
char RGUR_FFOV:
        1;  //RGUR=TX register under run, register over write (Cleared after Status Read Command )
        //FFOV=RX FIFO overflow (Cleared after Status Read Command )
char POR:
        1;          //Power-on reset (Cleared after Status Read Command )
char RGIT_FFIT:
        1;  //RGIT=TX register is ready to receive the next byte
        //(Can be cleared by Transmitter Register Write Command)
        //FFIT=The number of data bits in the RX FIFO has reached the pre-programmed limit
        //(Can be cleared by any of the FIFO read methods)
    }bits;
} status_H;

union
{
    unsigned char byte;
    struct
    {
char OFFS:
        4;      //Offset value to be added to the value of the frequency control parameter (Four LSB bits)
char OFFS6:
        1;      //MSB of the measured frequency offset (sign of the offset value)
char ATGL:
        1;      //Toggling in each AFC cycle
char CRL:
        1;          //Clock recovery locked
char DQD:
        1;          //Data quality detector output
    }bits;
} status_L;

Reference to example: https://github.com/digistump/DigisparkArduinoIntegration/blob/master/examples/Digispark_Examples/Rfm12b/Rfm12b.ino

Internally, the latest version of TinyGPS stores lat/lon as long integers, in units of degrees*10^6. If you can access those integers, you can transfer them via I2C.

jremington thanks.

Can you give me a little sample?

I see in sample on page http://arduiniana.org/libraries/tinygpsplus/

Serial.println(gps.location.lat()); // Latitude in degrees [u](double)[/u]       :(
Serial.println(gps.location.lng()); // Longitude in degrees [u](double)[/u]   :(

And i need custom NMEA Sentence Extraction, distanse and course features from TinyGPS++ lib...

@jremington:

Google is your friend.

The author of the library, Mikal Hart, has a good write-up describing his old/new libraries for GPS: http://arduiniana.org/libraries/tinygpsplus/

You should find what you need there. It's like the games we played as children... connect the dots to get a bigger picture.

Ray