Gammon power saving sketch H: BODS not declared error

Hey,

I have simply copied the example Sketch H, only adjusting the LED pin to 13.
Original:

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

const byte LED = 13;

void flash ()
  {
  pinMode (LED, OUTPUT);
  for (byte i = 0; i < 10; i++)
    {
    digitalWrite (LED, HIGH);
    delay (50);
    digitalWrite (LED, LOW);
    delay (50);
    }
    
  pinMode (LED, INPUT);
    
  }  // end of flash
  
// watchdog interrupt
ISR (WDT_vect) 
{
   wdt_disable();  // disable watchdog
}  // end of WDT_vect
 
void setup () { }

void loop () 
{
 
  flash ();
  
  // disable ADC
  ADCSRA = 0;  

  // clear various "reset" flags
  MCUSR = 0;     
  // allow changes, disable reset
  WDTCSR = bit (WDCE) | bit (WDE);
  // set interrupt mode and an interval 
  WDTCSR = bit (WDIE) | bit (WDP3) | bit (WDP0);    // set WDIE, and 8 seconds delay
  wdt_reset();  // pat the dog
  
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);  
  noInterrupts ();           // timed sequence follows
  sleep_enable();
 
  // turn off brown-out enable in software
  MCUCR = bit (BODS) | bit (BODSE);
  MCUCR = bit (BODS); 
  interrupts ();             // guarantees next instruction executed
  sleep_cpu ();  
  
  // cancel sleep as a precaution
  sleep_disable();
  
  } // end of loop

Error copied:

Arduino: 1.6.5 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Build options changed, rebuilding all

In file included from gammon_h.ino:4:0:
gammon_h.ino: In function 'void loop()':
gammon_h:50: error: 'BODS' was not declared in this scope
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:115:25: note: in definition of macro 'bit'
#define bit(b) (1UL << (b))
^
gammon_h:50: error: 'BODSE' was not declared in this scope
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:115:25: note: in definition of macro 'bit'
#define bit(b) (1UL << (b))
^
'BODS' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.


What am I missing?

Wrong processor for the sketch. Brown-out is turned off in some other way, so consult the data sheet.

Ok, thanks. Working with the 2560

I turn the BODLEVEL fuse to off, that seems to work.