Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ATmega 328 non-P? #53

Open
PaulRB opened this issue Feb 4, 2018 · 0 comments
Open

Support for ATmega 328 non-P? #53

PaulRB opened this issue Feb 4, 2018 · 0 comments

Comments

@PaulRB
Copy link

PaulRB commented Feb 4, 2018

Hi, is there a reason why the library does not support the non-P version of ATmega328?

With board selected as "ATmega328", sketches will not compile. To overcome this, I amended line 112 of LowPower.h as follows:
#if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega168__)

The sketch below now compiles and uploads fine.

// **** INCLUDES *****
#include "LowPower.h"

void setup()
{
    Serial.begin(115200);
}

void loop() 
{
    Serial.println("Sleeping...");
    Serial.flush();
    // Enter power down state for 4 s with ADC and BOD module disabled
    LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF);  
    
    Serial.println("Woke up...");
    Serial.flush();
    delay(4000);
}

I measure the current consumption during the sleeping periods at around 20-25uA vs. around 3.6mA when awake (8MHz internal clock, 3.3V). Not as low as a 328P, but not too bad at all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant