Problem shift register 74HC595N

Hi! I have problem with my project. I want to control LED using microcontroller. LED don’t light up. I have a voltage on the microcontroller. I’m using a 74HC595N microcontroller, 8x 220 ohm resistors, 10k ohm potentiometer.

I attach my schema.

My code:

const byte PIN_LATCH = 11;
const byte PIN_CLOCK = 12;
const byte PIN_DATA = 8;
const int MIN_DELAY = 50;
const int MAX_DELAY = 500;

byte val = 1;
byte dir_forward = 1;

void setup() 
{
  pinMode(PIN_LATCH, OUTPUT);
  pinMode(PIN_CLOCK, OUTPUT);
  pinMode(PIN_DATA, OUTPUT);
 
  digitalWrite(PIN_LATCH, LOW);
  shiftOut(PIN_DATA, PIN_CLOCK, MSBFIRST, 0);
  digitalWrite(PIN_LATCH, HIGH);
}

void loop() 
{
    int pot_val = analogRead(A5);
    int delay_time = map(pot_val, 0, 1023, MIN_DELAY, MAX_DELAY);    

    digitalWrite(PIN_LATCH, LOW);
    shiftOut(PIN_DATA, PIN_CLOCK, MSBFIRST, val);
 
    if(dir_forward)
    {
      val <<= 1;
 
      if(128 == val)
        dir_forward = 0;
    }
    else
    {
      val >>= 1;
 
      if(1 == val)
        dir_forward = 1;
    }
 
    digitalWrite(PIN_LATCH, HIGH);
    delay(delay_time);
}

Please help solve the problem.

What problem?

Diodes do not light up.

Hi,
Have you got the LEDs in the correct way?
The long leg, is Anode and goes to the 220R resistor, the shorter leg is kathode and goes to the gnd or neg of the board.
What pattern are you trying to put on the LEDs, it looks like "val".
Try B00000000 and try B11111111 instead of val in the

shiftOut(PIN_DATA, PIN_CLOCK, MSBFIRST, val);

shiftOut(PIN_DATA, PIN_CLOCK, MSBFIRST, B00000000);

shiftOut(PIN_DATA, PIN_CLOCK, MSBFIRST, B11111111);

Do you have a DMM to measure some voltages?

Thanks.. Tom. :slight_smile:

On your Fritzy you have omitted ground to pin 8 of the '595 AND you have grounded pin 10 of the '595 which is !SRCLR (active low).

If your actual circuit is wired as shown on the Fritzy, I'm not surprised nothing lights up.

Oh my bad. I had a pin 10 of the '595 connected to the GND. I switched to voltage and it is ok. Thanks guys.