# Nearest Multiple Spikes

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)$$

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

* $$P\_C=$$ Current Position
* $$R↑=$$ Round Up
* $$R↓=$$ Round Down
* $$F=$$ Factor Value
* $$S=$$ Offset Value

$$|P\_C-(R↑\[P\_C/F]\*F+S)| <^? |P\_C-(R↓\[P\_C/F]\*F+S)|$$

#### If Yes, $$NewTargetPosition=NewForwardPosition$$

$$New Forward Position = Round↑(CurrentMotorPosition/Factor) \* Factor + Offset$$

#### If No, $$NewTargetPosition=NewReversePosition$$

$$New Reverse Position = Round↓(CurrentMotorPosition/Factor) \* Factor + Offset$$

Nearest Multiple Spikes use the `↔` icon in the Spike List to indicate that they are a nearest multiple.

## Change The Type

<figure><img src="/files/5X8KkdqxFh7QPlWKSgVE" alt="Dynamic Spike Edit Nearest Multiple Type"><figcaption></figcaption></figure>

To change the type of spike, select the spike in the Spike List and then select nearest multiple from the type dropdown menu.

## Changing The Factor

<figure><img src="/files/4EG9rZyYGZJ1PEETyqa8" alt="Dynamic Spike Edit Nearest Multiple Factor"><figcaption></figcaption></figure>

To change the factor double-click in the Factor column and give it a new factor.

## Changing The Offset

<figure><img src="/files/Z6eNKzaQTzHtZ33zBDVZ" alt="Dynamic Spike Edit Nearest Multiple Offset"><figcaption></figcaption></figure>

To change the offset double-click in the Offset column and give it a new offset.

## Example

<figure><img src="/files/bl8NIiGxsbp6hi8YmAra" alt="Dynamic Spike Example Nearest Multiple"><figcaption></figcaption></figure>

In this example the turntable is running until an actor says their line then we want to stop the turntable and center it up as quick as possible. To do this we will use the nearest multiple spike to allow the turntable to run either direction to get back to center. The factor is set to 360 degrees (one full revolution) and the offset is set to 180 degrees (center).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.creativeconners.com/docs/spikemark-6/spikes/dynamic-spike-types/nearest-multiple-spikes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
