*************************Arduino Code***********************************
/* This Arduino Sketch is part of a tutorial on the ForceTronics YouTube Channel and demonstrates how to use the
Power Reduction Registers (PRR). It is free and open for anybody to use at their own risk.
*/
#include <avr/power.h>
/* Power Reduction Register (PRR) functions from avr/power.h library.
For every disable function there is an enable function
power_adc_disable() or power_adc_enable()
power_spi_disable() or power_spi_enable()
power_timer0_disable() or power_timer0_enable()
power_timer1_disable() or power_timer1_enable()
power_timer2_disable() or power_timer2_enable()
power_twi_disable() or power_twi_enable()
power_all_enable() or power_all_disable()
Note that for max power efficiency you should also disable the rest of the module for ADC and SPI
SPCR = 0; //disable SPI
ADCSRA = 0; // disable ADC
*/
void setup() {
delay(6000); //Delay to see normal power level first
ADCSRA = 0; // disable ADC by setting ADCSRA register to 0
power_adc_disable(); //disable the clock to the ADC module
delay(4000); //delay to see just ADC off power level
SPCR = 0; //disable SPI by setting SPCR register to 0
power_spi_disable(); //disable the clock to the SPI module
delay(4000); //delay to see just ADC and SPI off power level
power_all_disable();
}
void loop() {
// put your main code here, to run repeatedly:
}