The topic above is under "Sensors". I am not trying to double post, but I believe I need project guidance. My expensive way to "extend" arduino I2C is to just using another arduino unfortunately, which is making my project too big. Here is my current solution to communicate with two I2C devices:
Real I2C devices have addresses and can share the I2C bus. Your problem is that one of your devices is "I2C-like" but is not I2C. Replace the ADNS-2620 with a real I2C device or, as I recommended, the ADNS-3000 which uses SPI.
So using two arduinos is the only way to resolve this ASAP. It will take time to understand how ADNS-3000 would work, then I need to buy parts to have the complete mouse using ADNS-3000. Sparkfun has the breakout for ADNS2620, which is what I am using.
WTF.
I2c uses addresses, in fact 7 bits of them so you can have up to 127 devices in a single i2c bus, you can also use bit banged i2c to talk to your mouse and use the real i2c to talk to the green board.
Code compiles but I always get 0.00 degrees. I used A5 and A4 because using Wire.H through the same code (replace every "compass." with "Wire."), I am able to get compass data. However, when I switch to SoftTWI I get 0.00.
#include "SoftTWI.h"
SoftTWI compass;
void setup()
{
Serial.begin(9600); // Initiate Serial
compass.attach(A5, A4);
compass.begin();
}
void loop(){
compass.beginTransmission(0x21);
compass.send(65); // Send "Get Data" command, info from Datasheet
delay(100); // interface command delay, info from Datasheet
compass.requestFrom(0x21, 2); //get the two data bytes, MSB and LSB
byte MSB = compass.receive(); // Result will be in tenths of degrees (0 to 3599)
byte LSB = compass.receive(); // Provided in binary format over two bytes."
compass.endTransmission();
// Compute result from the two bytes results
float myres = ((MSB << 8) + LSB) / 10;
// Display result
Serial.print(myres);
Serial.println(" degrees");
delay(1000);
}