I have been playing with the Blink example:
int i = 35;
int maxInterval = 500;
int interval = maxInterval;
bool accelerate = true;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(interval);
digitalWrite(LED_BUILTIN, LOW);
delay(interval);
interval = accelerate ? (interval - i--) : (interval + i++);
if (interval < i) accelerate = false;
if (interval > maxInterval) accelerate = true;
}