1.0.1 • Published 3 years ago

@villagekit/stepper-ramp v1.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

@villagekit/stepper-ramp

install

npm install @villagekit/stepper-ramp

example

const createRamp = require('@villagekit/stepper-ramp')

const ramp = createRamp({
  targetSpeedInStepsPerSec: 50,
  accelerationInStepsPerSecPerSec: 50,
})

const movement = ramp.movement(100)

const stepPeriodsInMicrosecs = Array.from(movement)

console.log(stepPeriodsInMicrosecs)

api

createRamp = require('@villagekit/stepper-ramp')

ramp = createRamp(options)

options is an object with shape:

  • targetSpeedInStepsPerSec: max speed in (steps / second)
  • accelerationInStepsPerSecPerSec: acceleration in (steps / second^2)

stepPeriods = ramp.movement(steps)

steps is a number.

stepPeriods is an Iterable of step periods in microsecs.

1.0.1

3 years ago

1.0.0

3 years ago