Static Shift Register

I need help trying to program a static shift register. I just need help for a simple output on on of the pins

I thought all shift registers were static these days, I haven't seen a dynamic shift register for 40 years.

See:-

And don't put a capacitor on the latch pin that is an error.

Here you go this is my sketch for the shift register project I showed you yesterday you can check out the link below to wire up the register and then build it yourself and run my code.... the code is for 8 leds running off of a shift register the led's do all sorts of patterns that I added to the code

use this diagram for your build:

this is a shift register project I did a while ago notice there are only wires that come off of the board one is power one is ground one is Data, one is latch, and the last is clock so besides power and ground it only takes three wires to run 8 outputs and if you get a bigger register it will be more outputs.

here is a closeup of the register all the other wires go to the led's im using perf board so i didn't want to solder in long traces so i just jumped from the register to the led with a jumper

and here is my old sketch for the project use it freely to learn the registers

/*     ———————————————————
*     |  Arduino Experimentation Kit Example Code             |
*     |  CIRC-05 .: 8 More LEDs :. (74HC595 Shift Register)   |
*     ———————————————————
*
* We have already controlled 8 LEDs however this does it in a slightly
* different manner. Rather than using 8 pins we will use just three
* and an additional chip.
*
*
*/
//Pin Definitions
//The 74HC595 using a protocol called SPI (for more details http://www.arduino.cc/en/Tutorial/ShiftOut)
//Which has three pins
int data = 2;
int clock = 3;
int latch = 4;
//Used for single LED manipulation
int ledState = 0;
const int ON = HIGH;
const int OFF = LOW;
                        
/*
* setup() – this function runs once when you turn your Arduino on
* We set the three control pins to outputs
*/
void setup()
{
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);  
  pinMode(latch, OUTPUT);  
}
/*
* loop() – this function will start after setup finishes and then repeat
* we set which LEDs we want on then call a routine which sends the states to the 74HC595
*/
void loop()                     // run over and over again
{
  int delayTime = 10; //the number of milliseconds to delay
                        //between LED updates
  for(int i=0; i<5; i++)
  {
    changeLED(0,ON);
    delay(delayTime);
  changeLED(5,ON);
    delay(delayTime);
    changeLED(2,ON);
    delay(delayTime);
    changeLED(7,ON);
    delay(delayTime);
    changeLED(3,ON);
    delay(delayTime);
    changeLED(6,ON);
    delay(delayTime);
    changeLED(1,ON);
    delay(delayTime);
     changeLED(4,ON);
    delay(delayTime);

  changeLED(0,OFF);
    delay(delayTime);
  changeLED(5,OFF);
    delay(delayTime);
    changeLED(2,OFF);
    delay(delayTime);
    changeLED(7,OFF);
    delay(delayTime);
    changeLED(3,OFF);
    delay(delayTime);
    changeLED(6,OFF);
    delay(delayTime);
    changeLED(1,OFF);
    delay(delayTime);
     changeLED(4,OFF);
    delay(delayTime);
//above is what makes the led's turn off and on just mess around with the order to see what
//Kind of patterns you can make
  }
  }

/*
* updateLEDs() - sends the LED states set in ledStates to the 74HC595
* sequence
*/
void updateLEDs(int value){
  digitalWrite(latch, LOW);     //Pulls the chips latch low
  shiftOut(data, clock, MSBFIRST, value); //Shifts out the 8 bits to the shift register
  digitalWrite(latch, HIGH);   //Pulls the latch high displaying the data
}
/*
* updateLEDsLong() - sends the LED states set in ledStates to the 74HC595
* sequence. Same as updateLEDs except the shifting out is done in software
* so you can see what is happening.
*/
void updateLEDsLong(int value){
  digitalWrite(latch, LOW);    //Pulls the chips latch low
  for(int i = 0; i < 8; i++){  //Will repeat 8 times (once for each bit)
  int bit = value & B10000000; //We use a "bitmask" to select only the eighth
                               //bit in our number (the one we are addressing this time through
  value = value << 1;          //we move our number up one bit value so next time bit 7 will be
                               //bit 8 and we will do our math on it
  if(bit == 128){digitalWrite(data, HIGH);} //if bit 8 is set then set our data pin high
  else{digitalWrite(data, LOW);}            //if bit 8 is unset then set the data pin low
  digitalWrite(clock, HIGH);                //the next three lines pulse the clock pin
  delay(1);
  digitalWrite(clock, LOW);
  }
  digitalWrite(latch, HIGH);  //pulls the latch high shifting our data into being displayed
}
//These are used in the bitwise math that we use to change individual LEDs
//For more details http://en.wikipedia.org/wiki/Bitwise_operation
int bits[] = {B00000001, B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000};
int masks[] = {B11111110, B11111101, B11111011, B11110111, B11101111, B11011111, B10111111, B01111111};
/*
* changeLED(int led, int state) - changes an individual LED
* LEDs are 0 to 7 and state is either 0 - OFF or 1 - ON
*/
void changeLED(int led, int state){
   ledState = ledState & masks[led];  //clears ledState of the bit we are addressing
   if(state == ON){ledState = ledState | bits[led];} //if the bit is on we will add it to ledState
   updateLEDs(ledState);              //send the new LED state to the shift register
}

jpsnow6,

Please go back and add
</mark> <mark>[code]</mark> <mark>
to the line before your code and
</mark> <mark>[/code]</mark> <mark>
to the line after it and tell me that that does look a lot better that way.

thanks for the tip man Im new to the forums as well any little bit helps

There is a sticky post on how to use the forum. Follow the links fro how we work round here.

I would add a decoupling capacitor to that circuit.

http://arduino.cc/en/Reference/BitWrite

bitWrite()

Description

Writes a bit of a numeric variable.
Syntax

bitWrite(x, n, b)
Parameters

x: the numeric variable to which to write

n: which bit of the number to write, starting at 0 for the least-significant (rightmost) bit

b: the value to write to the bit (0 or 1)

Returns

none