MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
MeStepperOnBoard Class Reference

Driver for Me Stepper on MegaPi. More...

`#include <src/MeStepperOnBoard.h>`

## Public Member Functions
| MeStepperOnBoard ()
| MeStepperOnBoard (int slot)
void | setMicroStep (int8_t value)
void | setpin (int slot)
void | moveTo (long absolute)
void | moveTo (long absolute, int16_t extId, cb callback)
void | move (long relative)
void | move (long relative, int16_t extId, cb callback)
boolean | run (void)
boolean | runSpeed (void)
void | setMaxSpeed (float speed)
void | setAcceleration (float acceleration)
void | setSpeed (float speed)
float | speed (void)
long | distanceToGo (void)
long | targetPosition (void)
long | currentPosition (void)
void | setCurrentPosition (long position)
void | runToPosition (void)
boolean | runSpeedToPosition (void)
void | runToNewPosition (long position)
void | disableOutputs (void)
void | enableOutputs (void)
void | update (void)
virtual void | step (void)
int16_t | getPort (void)

## Protected Member Functions
void | computeNewSpeed ()

## Detailed Description

Driver for Me Stepper on MegaPi.

Class: MeStepperOnBoard

Description
  Declaration of Class MeStepperOnBoard.

Copyright (C), 2012-2016, MakeBlock

## Constructor & Destructor Documentation

## ◆ MeStepperOnBoard() [1/2]

MeStepperOnBoard::MeStepperOnBoard | ( |  | ) |

Alternate Constructor which can call your own function to map the stepper to arduino port, no pins are used or initialized here.

Parameters

  [in] | None |

## ◆ MeStepperOnBoard() [2/2]

MeStepperOnBoard::MeStepperOnBoard | ( | int | slot | ) |

Alternate Constructor which can call your own function to map the stepper to arduino port.

Parameters

  [in] | slot | - The slot of MegaPi boards.

Alternate Constructor which can call your own function to map the stepper to arduino port.

Parameters

  [in] | slot | - The slot of megapi boards.

## Member Function Documentation

## ◆ computeNewSpeed()

void MeStepperOnBoard::computeNewSpeed | ( | void |  | ) |
| protected

Function
  computeNewSpeed

Description
  Compute New Speed of Stepper.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ currentPosition()

long MeStepperOnBoard::currentPosition | ( | void |  | ) |

Function
  currentPosition

Description
  Stepper's current position.

Parameters

  [in] | None |

Output
  None

Return
  Return the current position of Stepper.

Others
  None

## ◆ disableOutputs()

void MeStepperOnBoard::disableOutputs | ( | void |  | ) |

Function
  disableOutputs

Description
  The Stepper disable the outputs.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ distanceToGo()

long MeStepperOnBoard::distanceToGo | ( | void |  | ) |

Function
  distanceToGo

Description
  The distance that Stepper should go.

Parameters

  [in] | None |

Output
  None

Return
  Return the length of Stepper's running.

Others
  None

## ◆ enableOutputs()

void MeStepperOnBoard::enableOutputs | ( | void |  | ) |

Function
  enableOutputs

Description
  The Stepper disable the outputs.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ getPort()

int16_t MeStepperOnBoard::getPort | ( | void |  | ) |

Function
  getPort

Description
  get the slot number of the stepper.

Parameters

  [in] | None |

Output
  None

Return
  The Slot number Stepper used.

Others
  None

## ◆ move() [1/2]

void MeStepperOnBoard::move | ( | long | relative | ) |

Function
  move

Description
  Stepper moves to the relative positions.

Parameters

  [in] | relative | - The relative length to Stepper's movement.

Output
  None

Return
  None

Others
  None

## ◆ move() [2/2]

void MeStepperOnBoard::move | ( | long | relative,
|  | int16_t | extId,
|  | cb | callback
| ) |  |

Function
  move

Description
  Stepper moves to the relative positions.

Parameters

  [in] | relative | - The relative length to Stepper's movement.
  [in] | extId | - It is used to indicate the ID of motor.
  [in] | callback | - callback function when the target position has been reached.

Output
  None

Return
  None

Others
  None

## ◆ moveTo() [1/2]

void MeStepperOnBoard::moveTo | ( | long | absolute | ) |

Function
  moveTo

Description
  Stepper moves to the absolute position.

Parameters

  [in] | absolute | - The absolute length to Stepper's movement.

Output
  None

Return
  None

Others
  None

## ◆ moveTo() [2/2]

void MeStepperOnBoard::moveTo | ( | long | absolute,
|  | int16_t | extId,
|  | cb | callback
| ) |  |

Function
  moveTo

Description
  Stepper moves to the absolute position.

Parameters

  [in] | absolute | - The absolute length to Stepper's movement.
  [in] | extId | - It is used to indicate the ID of motor.
  [in] | callback | - callback function when the target position has been reached.

Output
  None

Return
  None

Others
  None

## ◆ run()

boolean MeStepperOnBoard::run | ( | void |  | ) |

Function
  run

Description
  Stepper's status-—run or not.

Parameters

  [in] | None |

Output
  None

Return
  Return the status.

Others
  None

## ◆ runSpeed()

boolean MeStepperOnBoard::runSpeed | ( | void |  | ) |

Function
  runSpeed

Description
  The speed of Stepper's running.

Parameters

  [in] | None |

Output
  None

Return
  Return true or false.

Others
  None

## ◆ runSpeedToPosition()

boolean MeStepperOnBoard::runSpeedToPosition | ( | void |  | ) |

Function
  runSpeedToPosition

Description
  The speed of Stepper on the way to position.

Parameters

  [in] | None |

Output
  None

Return
  Return true or false.

Others
  None

## ◆ runToNewPosition()

void MeStepperOnBoard::runToNewPosition | ( | long | position | ) |

Function
  runToNewPosition

Description
  The Stepper runs to new position.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ runToPosition()

void MeStepperOnBoard::runToPosition | ( | void |  | ) |

Function
  runToPosition

Description
  Stepper runs to position.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ setAcceleration()

void MeStepperOnBoard::setAcceleration | ( | float | acceleration | ) |

Function
  setAcceleration

Description
  Set Acceleration for Stepper.

Parameters

  [in] | acceleration | - The acceleration for Stepper.

Output
  None

Return
  None

Others
  None

## ◆ setCurrentPosition()

void MeStepperOnBoard::setCurrentPosition | ( | long | position | ) |

Function
  setCurrentPosition

Description
  Set Stepper's current position.

Parameters

  [in] | position | - The current position for Stepper.

Output
  None

Return
  Return the current position of Stepper.

Others
  None

## ◆ setMaxSpeed()

void MeStepperOnBoard::setMaxSpeed | ( | float | speed | ) |

Function
  setMaxSpeed

Description
  Set Max Speed for Stepper.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ setMicroStep()

void MeStepperOnBoard::setMicroStep | ( | int8_t | value | ) |

Function
  setMicroStep

Description
  Set the micro step.

Parameters

  [in] | value | - the Subdivided value.

Output
  None

Return
  None

Others
  None

## ◆ setpin()

void MeStepperOnBoard::setpin | ( | int | slot | ) |

Function
  setpin

Description
  Set pin for Stepper.

Parameters

  [in] | slot | - The slot of MegaPi boards.

Output
  None

Return
  None

Others
  None

Function
  setpin

Description
  Set pin for Stepper.

Parameters

  [in] | slot | - The slot of megapi boards.

Output
  None

Return
  None

Others
  None

## ◆ setSpeed()

void MeStepperOnBoard::setSpeed | ( | float | speed | ) |

Function
  setSpeed

Description
  Set Speed for Stepper.

Parameters

  [in] | speed | - The speed of Stepper.

Output
  None

Return
  None

Others
  None

## ◆ speed()

float MeStepperOnBoard::speed | ( | void |  | ) |

Function
  speed

Description
  The Speed of Stepper.

Parameters

  [in] | None |

Output
  None

Return
  Return the Stepper's speed.

Others
  None

## ◆ step()

void MeStepperOnBoard::step | ( | void |  | ) |
| virtual

Function
  step

Description
  Stepper runs step by step.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ targetPosition()

long MeStepperOnBoard::targetPosition | ( | void |  | ) |

Function
  targetPosition

Description
  Stepper goes to target position.

Parameters

  [in] | None |

Output
  None

Return
  Return the position of Stepper.

Others
  None

## ◆ update()

void MeStepperOnBoard::update | ( | void |  | ) |

Function
  update

Description
  The Stepper loop function, used to move the stepper.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

The documentation for this class was generated from the following files:

- src/MeStepperOnBoard.h
- src/MeStepperOnBoard.cpp