- Posts: 71
- Karma: 1
- Thank you received: 4
#include <SPI.h>
#include <MySensor.h>
void setup() {
// put your setup code here, to run once:
// turn off ADC if not needed...
ADCSRA = 0;
//Now set the clock speed. I suggest that you do this as the last
//enty in setup as then all code before it will execute at full speed.
// Get ready to change the clock speed...
CLKPR = 0x80;
// Make sure that this line is *immediately* followed by the next line.
//No other code inbetween please.
//Set the next line by using one of the following .....
//0x01=clock divided by 2
//0x02=clock divided by 4
//0x03=clock divided by 8
//0x04=clock divided by 16
CLKPR = 0x03;
//So on an 8MHz pro mini the above will set it to 1MHz clock. - No fuses required!
}
void loop() {
// put your main code here, to run repeatedly:
//Add the following in your code where you want to sleep the arduino
//with lowest power //consumption.
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable();
MCUCR |= bit(BODSE) | bit(BODS); // timed sequence
MCUCR = (MCUCR & ~bit(BODSE)) | bit(BODS);
sleep_cpu();
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.