Hi, i am trying to control a pair of 74hc595n's. I did this successfully using python and the RPi, and having set the hardware up the same way i cannot work out how to output how i desire.
int dataPin = 2;
int latchPin = 3;
int clockPin = 4;
int data_out[] = {0,1,0,1, 0,1,0,1, 0,1,0,1, 0,1,0,1};
void setup() {
// put your setup code here, to run once:
pinMode(dataPin, OUTPUT);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(latchPin, LOW);
for (int thisLed = 0; thisLed < 16; thisLed++)
if (data_out[thisLed] != 0)
digitalWrite(dataPin, HIGH);
else
digitalWrite(dataPin, LOW);
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
digitalWrite(latchPin, HIGH);
delay(500);
}
when this is uploaded to my nano all the outputs are high! can anyone see what i have done wrong?