Go Down

Topic: Simple Shift Reg.(595) Question...? (Read 670 times) previous topic - next topic

quant

The following code sends 5V to Q7 as desired. But the problem is that it stays High, how can I make it stay on for just n seconds only?

thanks
Code: [Select]

void loop() {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, 1);
    digitalWrite(latchPin, HIGH);
    delay(3000);
}

marklar

First write code to turn off the pin and test it.  Then see this tutorial ..
http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

This will show you a good way to have something happen for x period of time. 

quant

Well I tried the following of No avail!?
Code: [Select]
void loop() {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, 1);
    digitalWrite(latchPin, HIGH);
    delay(3000);
  digitalWrite(latchPin, LOW); 
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    digitalWrite(latchPin, HIGH);
}

Wasn't that supposed to write Zero's to all the bits?
Isn't there a way of resetting the bits? I know pin 10 is Clear but don't know how to use it?

thanks for the help

quant

Well my mistake! I should have added a " delay(3000);" after the last line of code. :smiley-red:

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy