Skip to content

Instantly share code, notes, and snippets.

@jimmyli97
Last active August 29, 2015 14:13
Show Gist options
  • Save jimmyli97/9ff0e641bdaea49c3c9e to your computer and use it in GitHub Desktop.
Save jimmyli97/9ff0e641bdaea49c3c9e to your computer and use it in GitHub Desktop.
bool centerWingIsMoving = false;
bool centerWingDown = false;
int centerWingPulseTimeMs = 200;
void joyWing(DesiredMotorVals *desiredMotorVals, TJoystick *joyState) {
if (centerWingIsMoving) {
if (time1[T1] > centerWingPulseTimeMs) {
desiredMotorVals->power[Wing_Middle] = 0;
centerWingIsMoving = false;
centerWingDown = !centerWingDown;
}
} else {
if (joyButtonPressed(joyState, JOY1, BUTTON_X)) {
ClearTimer(T1);
centerWingIsMoving = true;
if (centerWingDown) {
desiredMotorVals->power[Wing_Middle] = 75;
} else {
desiredMotorVals->power[Wing_Middle] = -75;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment