Help in code for integrating ir sensor?

Write a short program to make a single LED turn on when a single sensor is triggered.

When that works, extend it so it turns off the LED when the sensor is triggered a second time.

When that works you will have a variable with a value that can be used to decide whether the motor should be running or stationary.

...R