Hi everybody, I’m new to the Arduino world and am trying to detect an incoming pulse on Int 0.
Hardware: I am using an ATTiny85 as an external generator to feed a signal to the Mega.
The tiny is pumping out a square wave that I can read on any one of the digital pins of the mega (eg: 21) if I attach an interrupt to it. I can see the square wave on the serial plotter. However, I would like to have it trigger an interrupt on Int 0.
I’ve connected the output from the Tiny to pin 53 (PB0) and then used the following code:
Serial.begin(9600, SERIAL_8N1); // Open the serial library @ 9600bps
// Initialize Timer1
TCNT1 = 0;
TCCR1B &= ~(1 << ICES1); // Capture on falling edge
TIMSK1 |= (1 << ICIE1);
// Set internal pullup resistor for Timer1 ICP1
DDRB &= ~(1 << PB0);
// Start the timer
TCCR1B |= (1 << CS10);
I leave the loop() empty since this very basic work is being done inside the ISR.
As an experiment, I enable the overflow as well using:
TIMSK1 |= (1 << ICIE1) | (1 << TOIE1);
and it was indeed caught inside here:
I assume it’s something simple that I’m missing, which is why digging through the other forum posts hasn’t given me the answer yet.