Button.pressed()?
- Dominant language
- C++
- Stars
- 40
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Would it make sense to introduce something like button.pressed() instead of readSwitch() ?
E.g. in https://github.com/arduino/EduIntro/blob/master/examples/by_topic/Button/Button.ino#L29
if (button.readSwitch() == LOW) { led.on(); } else { led.off(); }
if (button.pressed()) { led.on(); } else { led.off(); }
Or isPressed(), as in isPWM()
Kind regards,
Thomas
Contributor guide
Research direction
Start with examples/by_topic/Button/Button.ino, especially the readSwitch() usage at line 29, then inspect the Button API to understand existing naming and switch behavior. Decide whether a pressed() or isPressed() API is appropriate and update the example and relevant coverage so the new behavior is clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100