Skip to content

Instantly share code, notes, and snippets.

@5shekel
Created February 14, 2015 11:27
Show Gist options
  • Save 5shekel/1f52bcb8d1f2bad1ee78 to your computer and use it in GitHub Desktop.
Save 5shekel/1f52bcb8d1f2bad1ee78 to your computer and use it in GitHub Desktop.
// an alternative to the goStepper2 function from GRslider
void goStepper2(int i_dest, int i_velocity){
//takes the various cntrols for the slider stepper2
// and starts to moves the stepper
stepper2.enableOutputs();
//velocity between 0-127
//so we map it to ,mybe 10 diffrent values
i_velocity = map(i_velocity,0, 127, 0, 10);
//then we use this to grab a value from our spd2 array
stepper2_Speed = spd2[i_velocity];
stepper2.setMaxSpeed(stepper2_Speed);
stepper2.setAcceleration(stepper2_accl);
//i refer here to two arrays discrbing the same memebers :/
//i_dest = (sizeof(scalePos)/sizeof(int)) - 1;
int tempDest = i_dest - 20;
//Serial<<"idest/tempdest>"<<i_dest<<"/"<<tempDest<<endl;
stepper2.moveTo(scalePos[tempDest]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment