Group,
I have converted a sketch which I was running on an Arduino Mega to teensy 2.0. Most everything works, but I am having a strange problem and wanted to make sure I was coding the interrupt correctly. This is snippets of the code:
I am using pin 7 which is interrupt 2 according to the card. With Arduino, the line would be:
The sketch runs only if the scope lead is attached to the interrupt line or any of the outputs. The problem appears to be that there is not enough drive to the output unless the scope is attached. I do not think the interrupt is causing it and the sketch runs just fine on the Mega, I just wanted to make sure I had this part ciorrect.
Regards,
Keith
I have converted a sketch which I was running on an Arduino Mega to teensy 2.0. Most everything works, but I am having a strange problem and wanted to make sure I was coding the interrupt correctly. This is snippets of the code:
Code:
int zc_pin = 7; // external interrupt Teensy on int 0-4, pins 5-8 only
...
void setup() { // Begin setup
...
pinMode(zc_pin, INPUT); // 7 Teensy needs this defined
attachInterrupt(zc_pin, zero_cross_detect, RISING); // Attach an Interupt to zc_pin for Zero Cross Detection
...
Code:
attachInterrupt(2, zero_cross_detect, RISING); // Attach an Interupt to zc_pin for Zero Cross Detection
The sketch runs only if the scope lead is attached to the interrupt line or any of the outputs. The problem appears to be that there is not enough drive to the output unless the scope is attached. I do not think the interrupt is causing it and the sketch runs just fine on the Mega, I just wanted to make sure I had this part ciorrect.
Regards,
Keith