hello
sorry if this is mega obvious, but i cannot figure it out and could not find an appropriate answer in the archives even though i suspect similar questions may have been posted in the past, often.
my loop contains 2 separate parts:
- one reading from analogRead(0) connected to a pot
- the other sending midi notes.
i want the pot to be constantly read, so i put a delay(10) after it, but this is ignored – well, not ignored, but overruled because the midi part contains a delay too, in between note ons and note offs.
i am sure there’s a better way to do this
thanks
void loop()
{
{
val = analogRead(0);
}
if (val < 510) {
Serial.print("low: "); Serial.print(val); delay(50);
} else {
Serial.print("HIGHHH: "); Serial.print(val); delay(50);
}
delay(10);
int i;
int length = 8;
for (i = 0; i < length; i = i + 1) {
usbMIDI.sendNoteOn(newarray[i], velocities[i], 1);
Serial.print(newarray[i]);
Serial.print(" ");
delay(timelist[random(0, 2)]);
usbMIDI.sendNoteOff(newarray[i], 0, 1);
}