Hi all,
I'm just getting to grips with the shift register and am having a little trouble.
To begin with all I want to be able to do is turn on one (out of eight) LEDS.
I think (but am clearly wrong) that this code should do it:
int datapin = 2;
int clockpin = 3;
int latchpin = 4;
byte data = 0;
void setup()
{
// Set the three SPI pins to be outputs:
pinMode(datapin, OUTPUT);
pinMode(clockpin, OUTPUT);
pinMode(latchpin, OUTPUT);
}
void loop()
{
shiftWrite(0, HIGH);
}
void shiftWrite(int desiredPin, boolean desiredState)
{
bitWrite(data,desiredPin,desiredState);
shiftOut(datapin, clockpin, MSBFIRST, data);
digitalWrite(latchpin, HIGH);
digitalWrite(latchpin, LOW);
}
But my output looks like this (see attached image) - not the one LED I was looking for!
I am pretty sure everything is connected to the correct terminal, I have disassemble and reassembled several times.
Please help!
Thanks
Llewmihs
