Cypress技术论坛
直播中

王树林

7年用户 1645经验值
私信 关注
[问答]

使用Capsense按钮的不同应用程序

你好,
我想得到一个应用程序的信息。我推了CasSob按钮,例如WorkWork。如果我按更长的按钮,另一个马达工作。例如计数器。当我按下按钮一次,增加计数器一次,按住同一个按钮按钮计数器增加几十。我应该如何用程序做这个。谢谢。

以上来自于百度翻译


     以下为原文
    Hi,
    I want to get information for an application.I pushed capsense button, for example works motor. If I press the even longer same button works another motor. For example counter. When I pressed button for once, increase counter once, ı hold down same capsense button counter increase in tens. How should I do this with program. Thanks.

回帖(2)

杨军

2019-6-24 16:28:57
基本上,你实现了一个时间计数器或一个连接到ISR的时钟。到
区分你按住按钮的时间,并根据时间
实现不同的功能,比如启动备用电机。
所以创建一个计时器,比如说100毫秒,启用它的中断,每次ISR。
火灾公司时间计数器。然后在主()中测试计数器并基于其
价值行动不同的任务。当您释放时,清除时间计数器。
问候,Dana。

以上来自于百度翻译


     以下为原文
  Basically you implement a time counter or a clock connected to an ISR. To
    differentiate how long you hold a button down, and based on time held
    implement different functions, like starting the alternate motor.
     
    So create a timer, say 100 mS, enable its interrupt, and each time ISR
    fires inc a time counter. Then in main() test the counter and based on its
    value action different tasks. When released you clear the time counter.
     
    Regards, Dana.
     
   
举报

赵静

2019-6-24 16:43:28
用于控制电机:
你可以为此使用计时器。
当检测到按钮按压时,启动计时器。当按钮被释放时,停止计时器。
读取定时器值。
如果它超过一个阈值(由你选择,比如说2秒),则启动MaTe2。否则启动电机1。
当做。

以上来自于百度翻译


     以下为原文
  For controlling motors :--
     
    You can use a timer for this.
     
    As a button press is detected, start the timer . And as the button is released, stop the timer.
    Read the timer value.
    If it is more than a threshold value [selected by you, say 2 seconds] then motor2 is started. Else motor1 is started.
     
    Regards.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分