Arduino Sleep Mode question

I have this code I found on the net and Adafruits sleepydog. Just curious if I am missing something. is there a way of resuming other code after sleeping? As in wake up turn serial back on and stop going back into sleep mode? If so would you mind showing me with the AnalogReadSerial sketch? Thanks.

#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>


volatile int f_wdt = 1;



/***************************************************
    Name:        ISR(WDT_vect)

    Returns:     Nothing.

    Parameters:  None.

    Description: Watchdog Interrupt Service. This
                 is executed when watchdog timed out.

 ***************************************************/
ISR(WDT_vect)
{
  if (f_wdt == 0)
  {
    f_wdt = 1;
  }
  else
  {
    Serial.println("WDT Overrun!!!");
  }
}


/***************************************************
    Name:        enterSleep

    Returns:     Nothing.

    Parameters:  None.

    Description: Enters the arduino into sleep mode.

 ***************************************************/
void enterSleep(void)
{
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);   /* EDIT: could also use SLEEP_MODE_PWR_DOWN ..SLEEP_MODE_PWR_SAVEfor lowest power consumption. */
  sleep_enable();

  /* Now enter sleep mode. */
  sleep_mode();

  /* The program will continue from here after the WDT timeout*/
  sleep_disable(); /* First thing to do is disable sleep. */

  /* Re-enable the peripherals. */
  power_all_enable();
}



/***************************************************
    Name:        setup

    Returns:     Nothing.

    Parameters:  None.

    Description: Setup for the serial comms and the
                  Watch dog timeout.

 ***************************************************/

#define ledPin 13
#define VBATPIN A9

void setup()
{
 pinMode(ledPin, OUTPUT);
  Serial.println("Initialising...");
  delay(100); //Allow for serial print to complete.


  /*** Setup the WDT ***/

  /* Clear the reset flag. */
  MCUSR &= ~(1 << WDRF);

  /* In order to change WDE or the prescaler, we need to
     set WDCE (This will allow updates for 4 clock cycles).
  */
  WDTCSR |= (1 << WDCE) | (1 << WDE);

  /* set new watchdog timeout prescaler value */
  WDTCSR = 1 << WDP0 | 1 << WDP3; /* 8.0 seconds */

  /* Enable the WD interrupt (note no reset). */
  WDTCSR |= _BV(WDIE);

  Serial.println("Initialisation complete.");
  delay(100); //Allow for serial print to complete.
  pinMode(ledPin, OUTPUT);
  //pinMode(LED, OUTPUT);
  pinMode(RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);

  //while (!Serial);
  Serial.begin(9600);
  delay(100);
}
void VBATPINcheck()  // read pins
{
  float measuredvbat = analogRead(VBATPIN);
  int VBATPINsense = analogRead(VBATPIN);
  measuredvbat *= 2;    // we divided by 2, so multiply back
  measuredvbat *= 3.3;  // Multiply by 3.3V, our reference voltage
  measuredvbat /= 1024; // convert to voltage
  Serial.print("VBat: " ); Serial.print(measuredvbat); Serial.print("VBatPIN: " ); Serial.println(VBATPINsense);

}void loop()
{ if (f_wdt == 1)
  {
    /* Toggle the LED */
    digitalWrite(ledPin, !digitalRead(ledPin));

    /* Don't forget to clear the flag. */
    f_wdt = 0;

    /* Re-enter sleep mode. */
    enterSleep();
  }
  else
  {
    /* Do nothing. */
  }
[code]

is there a way of resuming other code after sleeping?

No. You resume executing the line after the one where you fell asleep.

The point where you resume is:

  /* The program will continue from here after the WDT timeout*/
  sleep_disable(); /* First thing to do is disable sleep. */

After this, you can put any statements you want, to be executed after your siesta is over.

What am i missing here Serial never comes back. When the program goes to sleep and wakes up where does it start from?

void loop()

{sleep_disable();
 power_all_enable();
 Serial.begin(9600);
  if (f_wdt == 1)
              
  {
   
    sleep_disable();
     power_all_enable();
     Serial.begin(9600); 
VBATPINcheck();          
    /* Toggle the LED */
    digitalWrite(ledPin, !digitalRead(ledPin));

    /* Don't forget to clear the flag. */
    f_wdt = 0;
 sleep_disable();  
  power_all_enable();  
  Serial.begin(9600);    
    /* Re-enter sleep mode. */
    enterSleep();
  }
  else
  { sleep_disable();     
   power_all_enable();
   Serial.begin(9600);   
    /* Do nothing. */
  } }

What am i missing here

Decent formatting. NOTHING follows the {.

Blank lines between the function declaration and the { are just annoying.

Life's too short to read crappily formatted code.

You need to study some examples of properly putting the Arduino to sleep, and waking up. You enable sleep ONCE. You disable sleep ONCE.

You don't need to re-begin Serial after sleep. The microcontroller isn't reset during sleep, it's just paused. When it wakes up, it resumes execution right where it left off. It's a lot less complicated than you're trying to make it out to be.

Also, whoever put power_all_enable() in that example is an idiot. Maybe I want to keep some things disabled, thank you very much. An important function like that shouldn't be hidden away where it's not expected.