Background
Vampires are the usual sort. They sleep in coffins during the day and awake when it gets dark. Apart from the normal ways of killing them, they are immortal and so, despite their thirst for blood, they will never starve to death.
Currently there is a plague of vampires and although they could be killed by the usual means, it is decided to try and make use of them.
The setup
A vampire lies in its coffin. When light ceases to leak in under the lid, the vampire awakes. It lifts the lid and sits up. However the lifting of the lid operates a mechanism such that, after a short delay, a bright light becomes visible. Seeing the lamp, the vampire quickly retreats back into the coffin and pulls the lid closed. This causes the light to be hidden. The sequence repeats indefinitely. A crank mechanism attached to the lid operates some machinery and so the vampire's ceaseless movement is converted into useful work.
Problems
There is no piped electricity or gas at this time, so lighting a lamp with a delay might be difficult to implement. Also, lamps bright enough to simulate daylight would be very hard to make.
Assumptions
There are plenty of vampires to experiment with and banks of coffins would be possible.
Vampires can survive under moonlight and when subjected to a dozen or so candles. Above this level, the brighter it is, the faster they move to avoid it.
Clockwork is well understood.
Please ask for clarifications before answering.
Question
How should I design the setup to efficiently harness the movement of coffin lids? How does the lighting interact with the motion? Rough diagrams depicting the machinery will be welcomed.
EDIT
I specifically want the power to come from the opening and closing of lids with vampires popping up and down. Mainly this is for dramatic effect. I'm not looking for radically different methods.