Attiny85 & TLC5940…

not sure if this is & or vs…

using an attiny85 and the tlc5940, i would like to control 16 simple leds.

and trying not to use libraries, as most of the ones I’ve found drop errors all over the place.

the following code runs almost fine on the 74hc595, and the tpic6b595

i dropped the 74ch595 as it wasn’t driving the leds enough (weirdness when linking chips)
i dropped the tpic6b595 as i found that driving the individual brightness was not possible on the attiny85

and had some tlc5940s on hand, and these seem to fit the bill, except the arduino library seem to not work well (serial issues) and the only library designed for the attiny85 fail at the serial commands.

the following code i would like to run, preferably without a library, on the attiny85

int     latchPin = 2; //2
int     clockPin = 3; //3
int     dataPin = 0;  //0
byte    leds = 0;
int     currentLed;
int     ledArray[8] = {1, 2, 4, 8, 16, 32, 64, 128};
#define   INTERNAL2V56_NO_CAP (6)

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(micPin, INPUT);
}


void loop () {
  for (int i=0; i < 8; i++) {
  currentLed = i;
  showLeds();
  delay(75);
  }

  for (int i=7; i > 0; i--) {
  currentLed = i;
  showLeds();
  delay(75);
  }
}


void showLeds() {
  digitalWrite(latchPin, LOW); // hide the leds
  shiftOut(dataPin, clockPin, MSBFIRST, ledArray[currentLed]);
  digitalWrite(latchPin, HIGH); // show the led
}

i dropped the 74ch595 as it wasn't driving the leds enough (weirdness when linking chips)

Sounds like you were not decoupling them correctly. http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

There is no chance that your code will work because you are not synchronizing the writing to the chip with the clock pulses you should be feeding it.

Now Ive prcoceeded from 2 chips to 1 chip, how do I synchronise the chips?

I'm on a mission to make this as small as possible, and 1 attiny85 and 1 tlc5940 is favourable

how do I synchronise the chips?

Give them the same clock and feed the serial out of one to the serial in of the other. Did you get one chip to work?

Ahh, sorry I feel like I've fed bad information.

I had 2 X 74hc595s almost working, then I swapped to 2 X tpic7b595 had them working but didn't have brightness control over individual LEDs, so I changed to 1x tlc5940.

All the libraries I've found don't seem to work. But the chip is essentially a shift register with individual brightness control.

That's where I am. I have no output from the tlc at present

But the chip is essentially a shift register with individual brightness control.

No it is not, it is much more than that. Read the data sheet to see the signals you need to drive it. It requires a constant clock signal at high speed as well as a signals synchronised to that clock just to display stuff. Then to input a change in data you need to feed it in serially synchronised to the clock.

Basically that chip needs a lot of looking after, just to drive the LEDs in a non changing way. If I needed this requirement I would use either neopixels or a PCA9685.

Ahh, oh well, I have pca9685s on hand also... I'll give them a go