Close

Bumping my head until it works.

A project log for SHTTTRRR

A small shutter controller for Canon EOS Cameras

GlitchmakerGlitchmaker 01/13/2015 at 20:500 Comments

As stated before, i didn't want to use long delays to separate between photos. What I wanted was for the MC to wake up, check if it timed out and if so take a pic. To do so I altered the ISR code relative to the watchdog timer, to this:

ISR(WDT_vect)
{
	seconds++;
	if (state==RUN)
	{
		timeout--;
		if(timeout==0)
		{
			shoot();
			variable_blink(50,10,1);
			timeout=duration;
		}
	}
}

I also made some changes to the ISR function with the Interrupt vector to this:

ISR(PCINT0_vect)
{
	unset_interrupt();// halts interrups to avoid interference
	_delay_ms(250); //helps to debouce
	switch(state)
	{
		case START_P:
		start_second = get_seconds(); // gets initial second
		blink(1);
		state=STOP_P;
		break;
		case STOP_P:
		stop_second = get_seconds();// gets final second
		duration = stop_second - start_second;// calculates duration in seconds
		stored_duration = duration; // stores the base duration
		timeout=duration;
		blink(1);
		state=RUN;
		break;
		default:
		break;		
	}	
	set_interrupt();

With these changes and using the led to debug everything looked OK. But as we all will see it was still too soon to celebrate...

Discussions