For the Uno, you can set an interrupt on digital pins 2 and 3. Check out http://www.arduino.cc/en/Reference/attachInterrupt for more details.
Here is the example code from that page:
int pin = 13;
volatile int state = LOW;
void setup()
{
pinMode(pin, OUTPUT);
attachInterrupt(0, blink, CHANGE);
}
void loop()
{
digitalWrite(pin, state);
}
void blink()
{
state = !state;
}
In this case, blink() will be called anytime pin 0 changes state. If you only want the rising or falling edge, change the call to attachInterrupt to say RISING or FALLING instead of CHANGE.