Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By BigFootIT
#38980 With this simple sketch you can check this behavior with your eyes ;)

Code: Select allconst int REDPin = 12;   
const int GREENPin = 13; 
const int BLUEPin = 14;   

void setColourRgb(unsigned int red, unsigned int green, unsigned int blue) {
  analogWrite(REDPin, red);
  analogWrite(GREENPin, green);
  analogWrite(BLUEPin, blue);
}

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

  pinMode(REDPin, OUTPUT);
  pinMode(GREENPin, OUTPUT);
  pinMode(BLUEPin, OUTPUT);

  setColourRgb(0,0,0); //off
  Serial.println("Started");
}

void loop(void){
  delay(1000);
  Serial.println("DeepSleep now");
  ESP.deepSleep(10000000, WAKE_RF_DEFAULT); // Sleep 10 sec
  delay(1000);
}


The RGB Led (or 3 standard leds!) will be off for 1 second (execution time) and will be slightly turned on for 10 seconds (deep sleep time) ending with a "strong" blink when the deep sleep ends and ESP reboots!

What do you suggest?
User avatar
By sej7278
#39015
martinayotte wrote:There must be some code that place those GPIOs as output with HIGH state.


i just found the same thing with an led matrix + max7219, the CS pin was sometimes held high (about 2.8v) when going into deepSleep() the fix was:

Code: Select alldigitalWrite(CS, LOW);
delay(2000);
ESP.deepSleep(0);


i've got a feeling that deepSleep() is setting some pins to OUTPUT, HIGH, or maybe it just leaves the pins as they are and its a timing issue - if you don't clean up your pins before deepSleep() they are left in an unknown state. in theory to minimise current and be safe, they should all be set to INPUT_PULLUP by the deepSleep() function, which i believe is their default state (or at least is on most arduino-esque boards).

https://www.arduino.cc/en/Tutorial/DigitalPins