Pages: [1]   Go Down
Author Topic: Simple Shift Reg.(595) Question...?  (Read 592 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
void loop() {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, 1);
    digitalWrite(latchPin, HIGH);
    delay(3000);
}
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I tried the following of No avail!?
Code:
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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: