I2C Problem

What would you expect the following code to do? I expect it to connect to the device and then send 8 - 1’s. Instead it sends the binary number 2. Ive tried different numbers besides 255 and it always sends 2.

Also below are snapshots of the bus (sorry for the big pics). Yellow is clock and blue is data. Notice that the address variable is sent correctly, but not the data variable. I’ve even tried sending the address as the argument but I still get 2. I have no idea, please help.

#include <Wire.h>
int enable = 12;
int ledPin =  13;    // LED connected to digital pin 13
byte address = B1100101;
byte data = 255;

void setup()   
{
digitalWrite(enable, HIGH);    //Enable voltage regulators on host board
delay(500);                    //Delay for regulators and other ICs to set up
}

void loop()                     
{
Wire.beginTransmission(address);
Wire.send(data);
Wire.endTransmission();
delay(1000);
}


I don’t see you initializing the Wire library. Try writing setup() as…

void setup()  
{
 Wire.begin();
 digitalWrite(enable, HIGH);    //Enable voltage regulators on host board
 delay(500);                    //Delay for regulators and other ICs to set up
}

Yeah that was it. ::)

Thank you!

Happens to me all the time... but seems to happen more often as I get older :'(