auto rapid fire test
This commit is contained in:
@@ -1,29 +1,30 @@
|
|||||||
|
#include <MsTimer2.h>
|
||||||
#include <SwitchControlLibrary.h>
|
#include <SwitchControlLibrary.h>
|
||||||
|
|
||||||
|
int loopCount = 0;
|
||||||
|
int state = 0;
|
||||||
|
|
||||||
|
void button() {
|
||||||
|
if (state == 0) {
|
||||||
|
SwitchControlLibrary().PressButtonA();
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SwitchControlLibrary().ReleaseButtonA();
|
||||||
|
state = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
SwitchControlLibrary();
|
SwitchControlLibrary();
|
||||||
|
MsTimer2::set(17, button);
|
||||||
|
MsTimer2::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
int loopCount = 0;
|
|
||||||
void loop()
|
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++;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user