Last active
August 29, 2015 14:13
-
-
Save jimmyli97/9ff0e641bdaea49c3c9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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