I am trying to connect an Adafruit 8x8 matrix to my photon and its not working.
After verifying that the matrix was working and it was connected correctly I created a test program to check that i2c was working.
Something doesn’t seem to be right. The docs say that the Write() function should return the number of bytes written however when I try to write one byte I get back a very large number.
Here is my test code and its output
void setup()
{
Wire.begin();
pinMode(led, OUTPUT);
Spark.publish("STEJ Started");
}
void test()
{
char buff[1024] = {0};
Wire.beginTransmission(0x70);
// the write function should return 1 but does not
sprintf(buff, "%d", Wire.write(1));
Spark.publish("write(1)", buff);
sprintf(buff, "%d", Wire.endTransmission());
Spark.publish("endTransmission", buff);
}
void loop()
{
test();
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
What am I doing wrong?