First off, please forgive me if I'm wrong, I know that this is a sensor related question, but I am having problems with I2C comm, not just the sensor, so I figured it belonged here.
I am using an Arduino Pro (3.3V, 8 MHz) from sparkfun on a bread board. I have the latest Arduino IDE and have it set to the proper board, but I am still thinking it could be a timing issue. The sensor's address is 0x28 or 40 (DEC), the company provides a few useful documents, which I'll link at the bottom. When I get to school tomorrow I can show my code, but it is basically a slightly modified version (I changed the address and the number of bytes read) of the master_reader example code. I tried sending it a zero first but that didn't help.
If anyone can help that'd be great. I know it's kind of generic without my code, and I apologize, I'll post it ASAP, I am just hoping somebody might recognize a common problem in the mean time.
EDIT: Here is my code.
// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this
// Created 29 March 2006
// This example code is in the public domain.
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
Serial.println("Probando initialization serial...");
}
void loop()
{
Wire.requestFrom(0x28, 2); // request 6 bytes from slave device #2
while(Wire.available()) // slave may send less than requested
{
char c = Wire.read(); // receive a byte as character
Serial.print(c); // print the character
}
delay(500);
}
Absolutely nothing, with this code. the wire.Available never gets triggered. the sensor isn't responding ar all.
// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this
// Created 29 March 2006
// This example code is in the public domain.
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
Serial.println("Testing serial...");
}
void loop()
{
int zero = 0;
Wire.requestFrom( 0x28, 2 );
while(Wire.available()) // slave may send less than requested
{
char c = Wire.read(); // receive a byte as character
Serial.print(c); // print the character
}
delay(500);
}
Normally I would say download a I2C bus scanner sketch like the one here (Gammon Forum : Electronics : Microprocessors : I2C - Two-Wire Peripheral Interface - for Arduino) but it looks like your device does not accept I2C writing, just reading. The bus scanner sketch's typically use the write function to verify the correct address which may not work in your case (of course it doesn't hurt to try).
Other things you should check is that you have the I2C lines connected to Analog pins 4 and 5 and not Digital pins 4 and 5 and that you're using properly sized pull up resistors if the internal ones are not enough.
After closer inspection of the packaging I confirmed my sucspicions. I accidentially ordered the SPI version of the sensor, sorry for wasting your time