Led blinking problem

Hi,
I'm in a project where I use a toggle switch, an arduino uno and an led. What I basically want to do is, when the toggle switch is in one state, the led lights up for half a second then switches off until the toggle switch is put into another state,, when the led will do the same thing until it goes into the other state etc.
I hope you can help me with my project
Thx

I think the IDE has state change examples.
Maybe work through some of the other examples too, like blink without delay.

You may also want to look at the Finite State Machine examples