Shift Register short pulse out

Hello,

i am currently playing around with a dual shift register set up on a bread board and a simple code that turns 16 LEDs on and off in sequence from eachother. Now, since the outputs are at 5v each i can use it to trigger an envelope generator on this little modular synth that i have, but the only problem is that the pulses going out are full until the next LED is triggered, which means there's no release time in between a shift thus the envelope generator stays "gated". Is there any way i can easily make them into shorter pulses?

use a shorter delay (sorry its hot as heck here and I may not be understanding the question as my brain is cooking)

I can add the code if that helps you:

int dataPin = 11;
int latchPin = 8;
int clockPin = 12;

int seq2[16] = {1,2,4,8,16,32,64,128,0,0,0,0,0,0,0,0};
int seq[16] = {0,0,0,0,0,0,0,0,1,2,4,8,16,32,64,128};
int value = 0;
int value2 = 0;

void setup(){
  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop(){
  for (int n=0; n < 16; n++)
  {
    value = seq[n];
    value2 = seq2[n];
    writeOutput();
    delay(200);
  }
}

void writeOutput(){
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, value);
  shiftOut(dataPin, clockPin, MSBFIRST, value2);
  digitalWrite(latchPin, HIGH);
}

Now, if i understand it correctly, it'll all happen inside the 'writeOutput' void, but i've tried added a delay and another digitalWrite(latchPin, LOW); for example but that didn't work...

Did this:

void writeOutput(){
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, value);
  shiftOut(dataPin, clockPin, MSBFIRST, value2);
  digitalWrite(latchPin, HIGH);
  delay(10);
  digitalWrite(latchPin, LOW);

Ok, i sort of got it now, i did this:

void writeOutput(){
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, value);
  shiftOut(dataPin, clockPin, MSBFIRST, value2);
  digitalWrite(latchPin, HIGH);
  delay(20);
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, 0);
  digitalWrite(latchPin, HIGH);
}

Works pretty ok. :slight_smile: