My main issue is that I have no way to know if the chip is even receiving my I2C communication. I have read through the code and the datasheet and everything seems to line up. Does anyone have any suggestions?
I ran the I2C program and it found no devices. Is it possible that I burn out the chip when soldering it onto the breakout board? What other explanations are there for this not working?
This bit of info relates to the pull up resistors specifically
Aside from the obvious (wrong pins and no pull up resistors) Are you sure both ends are operating ath the same voltage either bothe at 5v or both at 3.3 v ?
So I have been able to see the chip using the program mentioned above. However, beyond that, I am having trouble doing anything. I am new to I2C so I have no idea if the code that I am borrowing actually works. Does anyone know if the commands that I am sending are correct?
Your code does not do anything apart from mess about with the global brightness. You need to turn the individual LEDs on.
How have you wired up the LEDs. The outputs are open drain so the resistor should be connected to the output, then to the cathode of the. LED , finally the anode of the LED should be connected to the +ve supply.
You haven't got a reset command.
You don't finish the setLEDbrightness function with an end transmission call.
I am also not convinced you are writing to it correctly but it is late here and I am on my iPad so I can't check.
#include <Wire.h>
char allModuleAddress = 104;
char module1Address = 111;
void setup()
{
Serial.begin(9600);
pinMode(13,OUTPUT);
Serial.println("Serial Initialized");
Wire.begin();
Serial.println("Wire Initialized as Master");
initModule(allModuleAddress);
Serial.println("InitModules Completed");
digitalWrite(13,HIGH);
randomSeed(analogRead(0));
}
boolean a[] = {true,true,true,true,true};
void loop()
{
int r = int(random(0,5));
Serial.println(r);
a[r] = !a[r];
if(a[r]) setLed(r,255);
else setLed (r,0);
delay(50);
}
// Initialise all outputs for pwm and global dimming, switch off sleep mode
void initModule(char address)
{
Wire.beginTransmission(address);
Wire.write(0x80);
Wire.write(0x01);
Wire.write(byte(0x00));
for (char i=0; i<16; i++) {
Wire.write(byte(0xFF));
}
Wire.write(byte(0xFF));
Wire.write(byte(0x00));
for (char i=0; i<4; i++) {
Wire.write(B10101010);
}
Wire.endTransmission();
}
// Set the brightness of one output
void setLed(char lednum, char brightness) {
Wire.beginTransmission(module1Address);
Wire.write(lednum+2);
Wire.write(brightness);
Wire.endTransmission();
}
The next part of my project that I am trying to figure out is how to interface it with this Darlington Transistor Array...http://www.ti.com/lit/ds/symlink/uln2803a.pdf Does anyone know how to do this. I got the array working by itself by attaching GND to GND, nothing to COM and then +5v to the inputs to connect output and ground. The problem is that the LED driver is a sink, so how do I control the darlington array which requires +volts. And what does the common do?