0 votes
asked in ESPaper by (190 points)
Based on what I could discover in the code for the calendar program the "reset" button is used to pull the device out of deep sleep and run the program. My question is what other button options are available? I would like to program the center button or left button (S0 or S1) to do other things. I realize that these buttons wont work while the device is a sleep. That is not a problem. I can figure out the timing. Any help would be greatly appreciated.



1 Answer

0 votes
answered by (9.6k points)
selected by
Best answer

Other than what we documented at https://docs.thingpulse.com/guides/espaper-calendar/ (flash mode, config portal) there are no other pre-configured button options available.

Now if you want write custom applications and react to button events I suggest you study our code for the ESPaper Weather Station. Pointers: https://github.com/ThingPulse/espaper-weatherstation/blob/master/espaper-weatherstation.ino#L146 and https://github.com/ThingPulse/espaper-weatherstation/blob/master/settings.h#L109

commented by (190 points)
edited by
After reviewing this I see one of my mistakes was how I interpreted USR_BTN. I thought that was referring to the right most button on the unit. Now I see that it is defining the left button (S1 on the board). That makes more sense now. So the right button which is the reset button I assume cannot be programmed, correct? Its only purpose is to wake the unit up from sleep. So how do I work with the last button, the center button. It is labeled S0. Can this only be used for placing the unit into Flash mode?
commented by (190 points)
edited by
Looks like the center button is GPIO0 or in in this case a digitalRead(0) can be used to detect the button state change.
commented by (9.6k points)
Post-weekend catch up...

Yes, your analysis is correct. As the ESP8266 does not support waking from deep sleep by GPIO interrupt the left and center buttons only have any effect when the device is awake.
commented by (190 points)
Yep user instructions would be to press reset/wakeup button and then wait for the screen to refresh before attempting to use the two buttons. I decided to allow the unit to stay awake for 60 seconds so users could interact with the buttons. I'll see how badly this effects the battery life.

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.