Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

Explanation of releasedFor() was incorrect #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/en/api/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void loop() {

**Description:**

releasedFor(ms) check to see if the button is pressed (or released), and has been in that state for the specified time in milliseconds. Returns false (0) or true (1) accordingly.
This function returns 1 if button has been released for more than specified time. 1: pressed, 0: released.

**Example:**

Expand All @@ -109,8 +109,8 @@ void loop() {
M5.update();
M5.Lcd.clear();
M5.Lcd.setCursor(0, 0);
if (M5.BtnA.wasPressed()) {
M5.Lcd.printf("Button A was pressed.");
if (M5.BtnA.releasedFor(2000)) {
M5.Lcd.printf("Button A was released for more than 2 seconds.");
delay(1000);
}
}
Expand Down Expand Up @@ -243,4 +243,4 @@ void loop() {
M5.Lcd.print("Button A was Released");
}
}
```
```