arduino as trigger sequencer for modularsynthesizr

today i had the idea to build a tiny arduinobased trigger sequencer for my www.doepfer.de modular synthesizer.
the idea is to save the pattern in an array of 8 integers. filled with 1 and 0s.
then i use the interrupt 0 for clocking.
as soon as a rising edge is detected, the actual position of our array is checked to be 1. if it is 1 the output pin should be set to HIGH for a certain amount of time. if the array position contains a 0 nothing happens.

first i tested it with a pushbutton instead of the modular synthesizers square oscillator.
this worked.

but if i use the oscillator as clock, the output changes permanently from high to low when the interrput pin is set high. this should not be happening :frowning:

details: the oscillator produces a squarewave ranging from -5V to 5V. i used a 1n4004 diode for filtering the negative voltage.
maybe the ~4,3V of the positive square are not enough to give a constant high level? (well, i can't believe this. 2,5V okay - this could be causing problems, but 4,3V is clearly high, for my taste :wink:

has someone an idea?

my code is quite simple:

// the LEDpin is used as output for an LED for testing

#define LEDpin 4

int pattern[8] = {1, 1, 0, 0, 1, 0, 0, 0};

volatile int counter;
volatile int state = LOW;

void blink()
{
  if(pattern[counter] == 0) {    
    state = !state;
  }
  counter++;
  if (counter == 8) {
    counter = 0;
  }
}
  
void setup()
{
  counter = 0;
  pinMode(LEDpin, OUTPUT);
  attachInterrupt(0, blink, CHANGE);
}

void loop()
{
  digitalWrite(LEDpin, state);
}

maybe the rising edge of the oscillator signal is not "clear" enough. maybe it takes too much time, so that the interrupt is called many times, when it should be only one time called?

haha sometimes the solution to problems is just as easy as i am stupid:
it was a damn simple pull down resistor for the input...

i'll post pictures of the sequencer as soon as it's ready. can't decide wether to build it into a case of it's own or to put it into my modular systems case as module.

i'll post pictures of the sequencer as soon as it's ready. can't decide wether to build it into a case of it's own or to put it into my modular systems case as module.

Custom cases are always fun :slight_smile: