Use 1ms timer and table for scheduling

This commit is contained in:
2020-09-08 18:30:11 +09:00
parent 7eaa07ac3a
commit fc721f0537

View File

@@ -3,7 +3,20 @@
int loopCount = 0;
int state = 0;
int table[40] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int index = 0;
void perms() {
if (table[index] == 1){
SwitchControlLibrary().PressButtonA();
}
if (table[index] == 2){
SwitchControlLibrary().ReleaseButtonA();
}
index = (index + 1) % 40;
}
/*
void button() {
if (state == 0) {
SwitchControlLibrary().PressButtonA();
@@ -14,11 +27,12 @@ void button() {
state = 0;
}
}
*/
void setup()
{
SwitchControlLibrary();
MsTimer2::set(20, button);
MsTimer2::set(1, perms);
MsTimer2::start();
}