필터 지우기
필터 지우기

Button Latency Problem Help

조회 수: 2 (최근 30일)
Can
Can 2022년 10월 3일
답변: Vidip Jain 2023년 2월 21일
I am working with Raspberry Pi on Simulink. I have a save condition includes push button. If I press the button, values will save to the worksace, but everytime I pressed that button, it takes too much time to turn off and this cause to save to much value. This button must be on/off real quick and needs to save only one value. How can I solve this?

답변 (1개)

Vidip Jain
Vidip Jain 2023년 2월 21일
In this situation, multiple signals are sent when the button is pressed. There are a few different ways to ensure that only one signal is sent when the button is pressed, but one simple method is to add a short delay after that button is pressed before reading its value. This delay can be implemented in software using a timer or delay loop.
Here's a simple example of how you could implement debouncing in your Simulink model:
  1. Add a "Delay" block to your model, and set its delay time to a few milliseconds (e.g. 5ms).
  2. Connect the output of your button to the input of the Delay block.
  3. Connect the output of the Delay block to your save condition block.
  4. When the button is pressed, it will send a signal to the Delay block, which will delay the signal by a few milliseconds before passing it to the save condition block. This will ensure that only one signal is sent, even if the button bounces multiple times.

카테고리

Help CenterFile Exchange에서 Run on Target Hardware에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by