Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Only delay after serial output in "Knock"#81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
per1234 merged 1 commit intoarduino:mainfromper1234:knock-delay-position
Sep 11, 2024
Merged

Only delay after serial output in "Knock"#81

per1234 merged 1 commit intoarduino:mainfromper1234:knock-delay-position
Sep 11, 2024

Conversation

per1234
Copy link
Contributor

The "Knock" sketch polls the voltage output from a piezo disc to detect the vibrations associated with a knock.

The duration of vibrations from a single knock is likely to significantly exceed the unchecked polling interval. This would result in a single knock producing multiple detections, and thus multiple prints toSerial. In order to avoid this, a "debouncing" delay was added to the sketch.

Previously the delay was positioned in the outer scope of theloop function, which caused it to always affect the polling interval. This caused the sketch to miss the detection of knocks that produced vibrations that only occurred during that unnecessary delay. The problem is fixed by moving the delay inside the knock detection conditional block, so that debouncing is only done when actually needed.


Originally reported atarduino/docs-content#2159

The "Knock" sketch polls the voltage output from a piezo disc to detect the vibrations associated with a knock.The duration of vibrations from a single knock is likely to significantly exceed the unchecked polling interval. Thiswould result in a single knock producing multiple detections, and thus multiple prints to Serial. In order to avoidthis, a "debouncing" delay was added to the sketch.Previously the delay was positioned in the outer scope of the `loop` function, which caused it to always affect thepolling interval. This caused the sketch to miss the detection of knocks that produced vibrations that only occurredduring that unnecessary delay. The problem is fixed by moving the delay inside the knock detection conditional block, sothat debouncing is only done when actually needed.
@per1234per1234 added type: imperfectionPerceived defect in any part of project topic: codeRelated to content of the project itself labelsSep 11, 2024
@per1234per1234 self-assigned thisSep 11, 2024
@per1234per1234 merged commit00b6086 intoarduino:mainSep 11, 2024
17 checks passed
@per1234per1234 deleted the knock-delay-position branchSeptember 11, 2024 11:43
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees

@per1234per1234

Labels
topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@per1234

[8]ページ先頭

©2009-2025 Movatter.jp