I have the following LED display, which I want to hook up to Arduino UNO.
According to datasheet, there is clock pin. Do I have to build external clock source for it or I can feed it from Arduino?
Any practical advice on how to connect will be appreciated.
Update:
Thanks to Oli Glaser, I've created sketch for Arduino and presenting it here, just in case someone will have same type of LED display.
const int CLOCK_PIN = 2;
const int DATA_PIN = 3;
const int DATA_EN_PIN = 4;
const byte numbers[16] = {
0b11111100,
0b01100000,
0b11011010,
0b11110010,
0b01100110,
0b10110110,
0b10111110,
0b11100000,
0b11111110,
0b11100110,
0b11101110,
0b00111110,
0b10011100,
0b01111010,
0b10011110,
0b10001110
};
void loadLed(byte d1, byte d2, byte d3)
{
digitalWrite(DATA_EN_PIN, 0);
digitalWrite(DATA_PIN, 1);
digitalWrite(CLOCK_PIN, 1);
delayMicroseconds(5);
digitalWrite(CLOCK_PIN, 0);
delayMicroseconds(5);
for (int i=7; i >= 0; i--)
{
if(d1 & (1 << i))
digitalWrite(DATA_PIN, 1);
else
digitalWrite(DATA_PIN, 0);
digitalWrite(CLOCK_PIN, 1);
delayMicroseconds(5);
digitalWrite(CLOCK_PIN, 0);
delayMicroseconds(5);
}
for (int i=7; i >= 0; i--)
{
if(d2 & (1 << i))
digitalWrite(DATA_PIN, 1);
else
digitalWrite(DATA_PIN, 0);
digitalWrite(CLOCK_PIN, 1);
delayMicroseconds(5);
digitalWrite(CLOCK_PIN, 0);
delayMicroseconds(5);
}
for (int i=7; i >= 0; i--)
{
if(d3 & (1 << i))
digitalWrite(DATA_PIN, 1);
else
digitalWrite(DATA_PIN, 0);
digitalWrite(CLOCK_PIN, 1);
delayMicroseconds(5);
digitalWrite(CLOCK_PIN, 0);
delayMicroseconds(5);
}
for (int i=0; i <= 10; i++)
{
digitalWrite(DATA_PIN, 0);
digitalWrite(CLOCK_PIN, 1);
delayMicroseconds(5);
digitalWrite(CLOCK_PIN, 0);
delayMicroseconds(5);
}
digitalWrite(DATA_EN_PIN, 1);
}
void setup()
{
pinMode(CLOCK_PIN, OUTPUT);
pinMode(DATA_PIN, OUTPUT);
pinMode(DATA_EN_PIN, OUTPUT);
delay(100);
loadLed(numbers[7], numbers[8], numbers[3]);
}
void loop()
{
}
This can be optimized of course, but there is a slight problem - every fifth reset of the board will display random garbage. Tried to play with delay, set to 50 - no good. Looking for solution.