How to make LED flashing in different states

delay(100); // Approximately 10% duty cycle @ 1KHz

Nope. Not close.

Have a look at blink without delay