#include #include #define tableSize 40 int loopCount = 0; int state = 0; int table[tableSize]; int index = 0; int val = 1; int prevVal = 1; struct arrow { int pinNumber; int state; }; struct button { int pinNumber; bool prev; bool current; }; struct arrow arrowTable[4]; #define ButtonTableLength 1 struct button buttonTable[ButtonTableLength]; void perms() { if(val == 0){ if (table[index] == 1){ SwitchControlLibrary().PressButtonA(); } if (table[index] == 2){ SwitchControlLibrary().ReleaseButtonA(); } } index = (index + 1) % 40; } /* void button() { if (state == 0) { SwitchControlLibrary().PressButtonA(); state = 1; } else { SwitchControlLibrary().ReleaseButtonA(); state = 0; } } */ void setup() { table[0] = 1; table[tableSize/2] = 2; SwitchControlLibrary(); MsTimer2::set(1, perms); MsTimer2::start(); buttonTable[0].pinNumber = 3; for (int i; i(Hat::TOP)); } else if(arrowTable[2].state == 0){ SwitchControlLibrary().MoveHat(static_cast(Hat::BOTTOM)); } else if(arrowTable[1].state == 0){ SwitchControlLibrary().MoveHat(static_cast(Hat::LEFT)); } else if(arrowTable[3].state == 0){ SwitchControlLibrary().MoveHat(static_cast(Hat::RIGHT)); } else{ SwitchControlLibrary().MoveHat(static_cast(Hat::CENTER)); } }