Does this look right.

Is BUTTON 1 just a term or is it on Pin 1 and not on pin 3 in this statement.

#define BUTTONR 2 // Intr 0 = Pin 2 encoder push button
#define BUTTON 1 // Intr 1 = Pin 3

The 1 & 2 in Button 1 & Button 2 refer to D1 and D2.

INT0 is on D2, and INT1 is on D3, if that is what you are after (on '328P boards).

When you attach an interrupt, interrupt zero is on Arduino Pin 2, interrupt one is on pin 3. So, a statement like this:

attachInterrupt(0, rtc_interrupt,FALLING);

will be using an interrupt generated by the signal on pin 2. To use that pin the code will presumably do something like this:

pinMode(BUTTONR,INPUT);
digitalWrite(BUTTONR,HIGH); // to set the internal pullup

Pete

Is BUTTON 1 just a term

No. BUTTON is a name. 1 is a value. The preprocessor will substitute the value wherever else the name appears, in the rest of the code in the compilation unit.

Thank you all.

The 1 & 2 in Button 1 & Button 2 refer to D1 and D2.

INT0 is on D2, and INT1 is on D3, if that is what you are after (on '328P boards).

I'm using the mega 2560. and have changed pins to

#define BUTTONR 2 // Intr 0 = Pin 2 encoder push button
#define BUTTON 3 // Intr 1 = Pin 3

but the button stops working. Even though intr 1 is on Pin3

define BUTTON 3 // Intr 1 = Pin 3 turn knob

Why the hell is the "turn knob" called BUTTON?

When you attach an interrupt, interrupt zero is on Arduino Pin 2, interrupt one is on pin 3.

Except when it's not http://arduino.cc/en/Reference/attachInterrupt

PaulS:

define BUTTON 3 // Intr 1 = Pin 3 turn knob

Why the hell is the "turn knob" called BUTTON?

thanks changing that solved all my issues...........fail.

I'd value your help more than semantics.

UKHeliBob:

When you attach an interrupt, interrupt zero is on Arduino Pin 2, interrupt one is on pin 3.

Except when it's not http://arduino.cc/en/Reference/attachInterrupt

when is the mega pin 2 and pin 3 not intr 0, intr 1, not sure what you mean. :blush:

When you attach an interrupt, interrupt zero is on Arduino Pin 2, interrupt one is on pin 3

Look at the different interrupt to pin assignments for the Uno and the Leonardo

Look at the different interrupt to pin assignments for the Uno and the Leonardo

Yes, I see that. CrossRoads was referring to the UNO

CrossRoads: The 1 & 2 in Button 1 & Button 2 refer to D1 and D2.

INT0 is on D2, and INT1 is on D3, if that is what you are after (on '328P boards).

So your both correct. ;)