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++; }