i'm still not sure about that: what that code does is to check again and again if "N"uS has passed and then run the instructions i want, which should be:
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, Sample[i]);
digitalWrite(latchPin, HIGH);
i++;
right? but what's the purpose of the toggle variable? furthermore, where do i have to put my for-loop? please check this:
while(i<SAMPLES_NUMBER)
{
currentMicros = micros();
if (currentMicros - previousMicros >= 32)
{
previousMicros = currentMicros;
toggle = 1-toggle;
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, Sample[i]);
digitalWrite(latchPin, HIGH);
i++;
}
};
is it what i was supposed to write? i'm wondering if direct port manipulation would simplify the whole thing..