Lamp Timer

I got my Arduino Uno the other day, and i want to set up a lamp timer. I have it so that when the room lights go off, the reading lamp comes on, using a photocell. Now I want to know if there's code to make the lamp go off after 1/2 an hour, and turn back off it the lights are turned back on.

There'll be one when you write it.
Just make sure your reading lamp's light doesn't get picked up by your LDR, otherwise you'll just get a flashing light

Yep, I have the LDR and relay set up and working perfectly. No interference. And I know I can write it, I'm just looking for the basic code to use. I just got this and have no prior experience, so I just need a little help.

If the relay and LDR are working, you must already have some code, so when you post it, we can help.

Use a variable to track the lamp state (on or off).
Use a variable to track how long the lamp as been on.

In your loop() function, always set the lamp to that variable.

If the lamp is on, check to see how long it has been on. If enough time has gone by, set the state variable to off.

Check to see if the lamp should be turned on, if so, set the state variable to turn it on.