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 ![]()
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 ![]()
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);
}