Cannot get interrupts working

I have been trying to create a program that awakens the board from low power state. There is a lot written about this subject but I could not implement it because I could not get the interrupts to work properly.
I tried just copying and pasting the simple blinking LED light interrupt program on the arduino site but found that it does not work either.
I wrote a simple program that triggers the arduino to go in and out of low power mode when a button is pushed. I can get the arduino to enter sleep mode but can not awaken it with the interrupt.

#include <Keypad.h>
#include <avr/sleep.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() {
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);

void blink_isr() {

void goToSleep() {
  attachInterrupt(digitalPinToInterrupt(2), blink_isr, RISING);
  digitalWrite(13, HIGH);
  /* wake up here */
  digitalWrite(13, LOW);

void loop() {
  char key = keypad.getKey();

  if (key == '#') {


keypad interrupt.txt (1.05 KB)

Please post the code here to avoid the need for anyone helping to download it.

read this before posting a programming question

"when a button is pressed". One button is the "#" key and another is attached to pin 2. Right? Isn't that two Buttons? Also, in Addition to the program, we may Need to see your wiring diagram. How are you attaching to pin 2? Pullups? Pulldowns? What state is pin 2 set to, etc.?

It seems rather obvious that pin 2 is connected to one of the keypad columns. Possibly the one with the # key.

I would use the gotosleep function to set 2 to input pullup and the correct row to output low. Then use the falling type interrupt. When coming back from sleep, you will need to set those changes back to what the keypad library expects.

Don't use # as the wake up key because your finger is still on the # key when it starts to sleep.