My Completed blind controller project

Just posting up my code for my "open the blinds at dawn" project Machine | Paul Murray's Blog.

It features time slicing - while the motor is winding the blinds, you can hit a button at any time to stop it. To make that happen, I ignored the existing Stepper class and rolled my own - surprisingly easy.

I used a C++ class to encapsulate "a buttton that goes up and down", and extended it to implement "a button that knows about clicks and double-clicks".

Anyway. It all seems to work. Main thing missing is telling the board to sleep. I was powering the board with 4 AA batteries, and they went flat after 3 days. Now I have a 6v power supply. Could have used a USB power supply, but they were a bit more expensive. Apparently it's pointless sleeping the board anyway, because the USB socket chews power.

The stepper motor is powered with a pair of 6v lantern batteries. I'll see how long they last.