Skip to content

Instantly share code, notes, and snippets.

@HFreni
Created September 3, 2016 03:46
Show Gist options
  • Save HFreni/962583cf110cb01ed153ef81dd251270 to your computer and use it in GitHub Desktop.
Save HFreni/962583cf110cb01ed153ef81dd251270 to your computer and use it in GitHub Desktop.
int previousError = 0;
float errorSum = 0;
int powApplied = 0;
void liftPID(int target) {
int error = target - SensorValue[sensorLift];
int derivative = error - previousError;
powApplied = (error*2.0 + derivative*0.3);
setLift(powApplied);
previousError = error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment