First Light
Saturday, March 31st, 2012It’s hard to tell from the picture but the LED is on and this is mostly working. I say mostly because this is strictly a timed sequence and sometimes the unit can take a varying time to take a picture. This can be enough to throw off the timing and the unit ends up staying on most of the time and not taking any pictures. The solution to this is to monitor the LED status, so thats the next job.
Here’s the code:
while (1)
{
// Power On
PORTB |= _BV(3);
delayMs(100, 20); // 100ms * 20 times = 2s
PORTB &= ~_BV(3);// Shutter
delayMs(100, 10); // 100 ms * 10 times = 1s
PORTB |= _BV(4);
delayMs(100, 1); // 100ms * 1 times = 100ms
PORTB &= ~_BV(4);// Power Off
PORTB |= _BV(3);
delayMs(100, 20); // 100 ms * 20 times = 2s
PORTB &= ~_BV(3);delayMs(150, 100); // 150ms * 100 times = 15s
}