I'm very new to the Arduino/Microcontroller-world, so please be patient :)
I have 4 potentiometers and I want my LED to blink up, when one of these is beeing used.
So far., so good.. the potentiometers are sending singnals to my inputs A0-A3. In the code I read and buffer the values of send to the inputs, so when a new value is recieved (potentiometer is beeing used), the funcion blinkLED() is beeing triggered:
int ledPin = 13;
int pin[] = {A0, A1, A2, A3};
int cc[] = {20, 21, 22, 23};
int potiValues[] = {0, 0, 0, 0};
int potiValuesTmp[] = {0, 0, 0, 0};
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
// READ EVERY PIN
for(int i=0; i<=3; i++){
potiValues[i] = map(analogRead(pin[i]), 0, 1023, 0, 127);
if(potiValues[i] != potiValuesTmp[i]) {
// NEW VALUE RECIEVED - MAKE OUTPUT
Serial.println("Pin ");
Serial.print(pin[i]);
Serial.print(" - ");
Serial.print("Value: ");
Serial.print(potiValues[i]);
blinkLED();
}
potiValuesTmp[i] = potiValues[i];
}
}
void blinkLED() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
}
It somehow works on the emulator circuits.io, but I'm not sure if I did it right(?) Maybe someone could have a look and tell me, what to improve?
But my main question is:
When the function blinkLED() is triggered, there is this delay,.. does the whole loop()-function wait, too?