The Hexbright is an Arduino-compatible open source flashlight that was the subject of a very successful kickstarter campaign in 2011.
Today I spent a short time working on some custom firmware for it.
My firmware adds two new features:
Button presses cycle between modes (low, med, high brightness) as usual, but if you wait longer than CYCLE_DELAY (default 5 seconds) between presses, the next press turns the hexbright off.
If the hexbright is left on for longer than AUTO_OFF_MINUTES (defaults to an hour), the hexbright turns off. Handy for when you prop the light somewhere and forget about it.