Hi,
Can some kind person explain how this loop would repeat indefinitely, please?
void loop()
{
for (int x = 0; x < 3; x++)
{
if (digitalRead(buttonPins[x]) == LOW)
{
Serial.print("The button on pin ");
Serial.print(buttonPins[x]);
Serial.println(" is pressed");
}
}
}
What I am unsure about is how the loop works once x=3.
Does x revert back to 0 once x=3 so the loop keeps looping or does it only loop 3 times then become false and the loop stops?
Would it be better to use unsigned int?
Thanks,
Martin