How to Sum button presses with RTCIO, when esp32 in deep sleep mode

Hi guys,

I have an issue about RTCIO pin that i want it to be INPUT when my board is in DEEP SLEEP mode. My main problem is ; i want to follow press numbers for a button, collect them and after 30 minutes later, show it in serial monitor. How many times that button got pressed in 30 minutes.

[code]#include<SoftwareSerial.h>
#include<Wire.h>
#define RXD2 16
#define TXD2 17
RTC_DATA_ATTR int a = 0;
RTC_DATA_ATTR int b = 0;
String MySend = "";
String stringOne="";

void findDigitNum(int & n,int number){

int count = 0;
while(number != 0 ){
number /= 10;
count++;

}
n = count;

}

void settingsOn() {

Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
Serial.begin(9600);

Serial2.println("AT+JOIN=1:0:10:8");

}

void setup() {

esp_sleep_enable_ext0_wakeup(GPIO_NUM_32, 1);
settingsOn();

a++;
if(a % 10 == 0){
findDigitNum(b,a);
delay(10);
Serial.println("AAAA:" + String(b));
stringOne = String(a);
if(b % 2 == 1){

  MySend = "AT+SEND=1:0"+String(stringOne);
  }
  else
 MySend = "AT+SEND=1:"+String(stringOne);


 Serial2.println(MySend);
 Serial.println(MySend);

}

delay(3000);
esp_deep_sleep_start();

}

void loop() {

}[/code]

@tortudereli, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

I see that you made an attempt to use code tags; the [code] and [/code] must be on their own lines for that to work; please edit your post to fix it.