From 02f2c7a2ef75fa44d9444f3ec450233bf782a940 Mon Sep 17 00:00:00 2001 From: sirrow Date: Sun, 6 Sep 2020 17:02:45 +0900 Subject: [PATCH] auto rapid fire test --- connect_switch.ino | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/connect_switch.ino b/connect_switch.ino index 56fd6f6..5231f66 100644 --- a/connect_switch.ino +++ b/connect_switch.ino @@ -1,29 +1,30 @@ +#include #include +int loopCount = 0; +int state = 0; + +void button() { + if (state == 0) { + SwitchControlLibrary().PressButtonA(); + state = 1; + } + else { + SwitchControlLibrary().ReleaseButtonA(); + state = 0; + } +} + void setup() { - SwitchControlLibrary(); + SwitchControlLibrary(); + MsTimer2::set(17, button); + MsTimer2::start(); } -int loopCount = 0; + void loop() { - if (100 < loopCount) - loopCount = 0; - if (loopCount == 50) - { - SwitchControlLibrary().PressButtonL(); - SwitchControlLibrary().PressButtonR(); - SwitchControlLibrary().ReleaseButtonL(); - SwitchControlLibrary().ReleaseButtonR(); - } - if (loopCount == 100) - { - SwitchControlLibrary().PressButtonA(); - SwitchControlLibrary().ReleaseButtonA(); - } - - loopCount++; }