anupam19 / i2c-gps-nav

Automatically exported from code.google.com/p/i2c-gps-nav
0 stars 0 forks source link

Brand of GPS #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have a test environment setup using a 4800 baud GPS to one Arduino. I have 
the two arduinos SDA, SLC and ground connected and made sure they were talking 
with each other using the IDE master/slave examples. 

Problem, I am receiving tons of I2C errors and the Wii GUI is not reporting any 
information about the GPS such as SAT found etc.

I modified the following sketch to see of the MWC was sending the request but 
it appears the MWC is not receiving an answer back generating massive number of 
I2C bus errors.

#include <Wire.h>

void setup()
{
  Serial.begin(115200);  // start serial for output
  Wire.begin(0x20);                // join i2c bus with address #2
  Wire.onRequest(requestEvent);          // Set up event handlers
  Wire.onReceive(receiveEvent);
}

void loop()
{
  delay(100);
}

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent()
{
  Serial.println("Request "); // respond with message of 6 bytes
                       // as expected by master
}

void receiveEvent(int bytesReceived)
{
  int a = Wire.read();
  Serial.print("Received "); // respond with message of 6 bytes
                       // as expected by master
  Serial.print(a);
}

Original issue reported on code.google.com by reverendrichie on 14 Mar 2012 at 1:38