Couldn't you also do it without timer interrupts? Something like this perhaps (please excuse the C code)?
You could use a circuit as simple as the "Spinning Class Strobe" (below) but you would need to change the potentiometer scale to represent a Period of 1 to 103 seconds.Code:while(1) { period = adcin(3); // read pot' period = period / 10 + 1; // scale to 1..103 (seconds) count = 1; // start new period while(period < count) // { delay_ms(1000); // delay 1 second count++; // bump count var' } led = 1; // turn on led delay_us(500) // for 1/2 second led = 0; // and off delay_us(500) // for 1/2 second }
Regards, Mike





Bookmarks