Button Interruption

Hi, I was looking for information related to interruptions, but couldn't find a answer for my question. I think it's not that hard to solve.

I'm making a LCD + RTC + Temperature Sensor project.

I want to make the time configurable using buttons.

I want to use 3 buttons that when pressed do something, but there is only two interruptions, what would be the solution?

also, im making something like

void valor() {
hora++;
}

to add hour when its pressed, but it usually ads way more then 1 hour everytime. Any idea how to fix this too??

Thanks

It's almost certain that you won't need interrupts for what you want to do.
If you structure your "read - convert - display" loop correctly, you'll find that there's a simpler way of doing what you want.

Interrupts are more for the sort of situation where you've got something shouting "LOOK AT ME NOW - I'M REALLY IMPORTANT".

On the time scale of temperature changes and screen updates, this is very unlikely.

im doing a delay(1000) before the end of the loop()

should I just decrease the delay and use a
buttonState = digitalRead(buttonPin);

or is there any better way of doing it?

another question,
I have 3 buttons,

I want to do like, if I press two at the same time for like some seconds it will able to change the hour. My code for that is bit ugly, but this is the idea

  if(b1==HIGH && b2==HIGH && b3==LOW) {
    if(activate<400) {activate++;}
  else {hour++;}
  }

i would like to know how would you do.
thanks :wink:

I'd get rid of the delay, and have your loop poll the clock each time through by calling "millis".
If a second has elapsed, update your clock, if it hasn't, then check your switches.
The delay would be the only reason you'd need an interrupt.

... usually ads way more then 1 hour everytime. Any idea how to fix this too??

The code to set the hours should use one of the techniques for handling button bounce. See: http://www.arduino.cc/en/Tutorial/Debounce