void setup() { pinMode(7, OUTPUT); }
void flashLED(int time, int iterations, int postdelay, int port) { // Flash an LED
for (int i=0; i<iterations*2; i++) { // Flash 3 times (requiring 6 iterations, 1 for on, 1 for off)
digitalWrite(port, i % 2 == 0 ? HIGH : LOW); // On every EVEN iteration, make HIGH, else make LOW
delay(time);
}
delay(postdelay); // Delay at the end of each iteration to avoid very short delays
}
void loop() {
const int ENDDELAY = 300; // Delay at the end of each letter to avoid very short delays
flashLED(500, 3, ENDDELAY, 7); // S
flashLED(200, 3, ENDDELAY, 7); // O
flashLED(500, 3, ENDDELAY, 7); // S
}