Nearest Multiple Spike

Nearest Multiple Spikes will move the motor in either direction to the closest multiple of Factor plus Offset. Put in other words:

NewTargetPosition=NearestMultiple(Factor+offSet)NewTargetPosition=NearestMultiple(Factor+offSet)

The NearestMultiple(Factor+offSet)NearestMultiple(Factor+offSet)is found by calculating the NewForwardPositionNew Forward Position and the NewReversePositionNew Reverse Position, then selecting which one is closest to the CurrentMotorPositionCurrent Motor Position and setting that as the New Target Position.

For Math Nerds

  • PC=P_C= Current Position

  • R=R↑= Round Up

  • R=R↓= Round Down

  • F=F= Factor Value

  • S=S= Offset Value

PC(R[PC/F]F+S)<?PC(R[PC/F]F+S)|P_C-(R↑[P_C/F]*F+S)| <^? |P_C-(R↓[P_C/F]*F+S)|

If Yes, NewTargetPosition=NewForwardPosition NewTargetPosition=NewForwardPosition

NewForwardPosition=Round(CurrentMotorPosition/Factor)Factor+OffsetNew Forward Position = Round↑(CurrentMotorPosition/Factor) * Factor + Offset

If No, NewTargetPosition=NewReversePositionNewTargetPosition=NewReversePosition

NewReversePosition=Round(CurrentMotorPosition/Factor)Factor+OffsetNew Reverse Position = Round↓(CurrentMotorPosition/Factor) * Factor + Offset

If none of this is making sense, check out our section on Using Spikes with a Turntable.

Changing the Type

Nearest multiple spikes are denoted with a (left right arrow) and use a Factor and an Offset.

To change the type double click in the Type column and select Nearest Multiple then press enter or tab to save it.

Changing the Factor

To change the factor double click in the Factor column give it a new factor and then press enter or tab to save it.

Changing the Offset‌

To change the offset double click in the Offset column give it a new offset and then press enter or tab to save it.

Last updated