I've tried to control the brightness with the Output Enable pin, but that didn't work very well.
int datapin = 13;
int clockpin = 12;
int output_enable = 11;
int latchpin = 8;
byte test[1];
int x = 0;
int brightness;
int potentiometer = A0;
void setup()
{
Serial.begin(9600);
pinMode(datapin,OUTPUT);
pinMode(latchpin,OUTPUT);
pinMode(clockpin,OUTPUT);
pinMode(output_enable,OUTPUT);
test[1] = 0b11111111;
}
void loop()
{
brightness = analogRead(A0);
analogWrite(output_enable, brightness);
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, test[1]);
digitalWrite(latchpin, HIGH);
}
Where is the mistake?
It works much better when a potentiometer is connected in series to the supply voltage input, the LEDs go fluently from dark to light, but does this also work when a Darlington Array is also connected in series (to supply the LEDs)?