MakeBlock Drive Updated Updated library for MakeBlock Ranger

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

Driver for Me Megapi DC motor device. More...

`#include <src/MeMegaPiDCMotor.h>`

## Public Member Functions
| MeMegaPiDCMotor (void)
| MeMegaPiDCMotor (uint8_t port)
| MeMegaPiDCMotor (uint8_t dc_dir_h1, uint8_t dc_dir_h2, uint8_t pwm_pin)
void | reset (uint8_t port)
void | setpin (uint8_t dc_dir_h1, uint8_t dc_dir_h2, uint8_t pwm_pin)
void | run (int16_t speed)
void | stop (void)

## Detailed Description

Driver for Me Megapi DC motor device.

Class: MeMegaPiDCMotor

Description
  Declaration of Class MeMegaPiDCMotor

Copyright (C), 2012-2016, MakeBlock

## Constructor & Destructor Documentation

## ◆ MeMegaPiDCMotor() [1/3]

MeMegaPiDCMotor::MeMegaPiDCMotor | ( | void |  | ) |

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

Parameters

  [in] | None |

## ◆ MeMegaPiDCMotor() [2/3]

MeMegaPiDCMotor::MeMegaPiDCMotor | ( | uint8_t | port | ) |

Alternate Constructor which can call your own function to map the DC motor to arduino port

Parameters

  [in] | port | - megapi dc port from PORT_1 to PORT_12

## ◆ MeMegaPiDCMotor() [3/3]

MeMegaPiDCMotor::MeMegaPiDCMotor | ( | uint8_t | dc_dir_h1,
|  | uint8_t | dc_dir_h2,
|  | uint8_t | pwm_pin
| ) |  |

Alternate Constructor which can call your own function to map the DC motor to arduino port, it will assigned the output pin.

Parameters

  [in] | dc_dir_h1 | - arduino port for direction pin1
  [in] | dc_dir_h2 | - arduino port for direction pin2
  [in] | pwm_pin | - arduino port for pwm input(should analog pin)

## Member Function Documentation

## ◆ reset()

void MeMegaPiDCMotor::reset | ( | uint8_t | port | ) |

Function
  setpin

Description
  Reset the DC motor available PIN by megapi port.

Parameters

  [in] | port | - megapi dc port from PORT_1 to PORT_12

Output
  None

Returns
  None

Others
  None

Function
  reset

Description
  Reset the DC motor available PIN by megapi port.

Parameters

  [in] | port | - megapi dc port from PORT_1 to PORT_12

Output
  None

Returns
  None

Others
  None

## ◆ run()

void MeMegaPiDCMotor::run | ( | int16_t | speed | ) |

Function
  run

Description
  Control the motor forward or reverse

Parameters

  [in] | speed | - Speed value from -255 to 255

Output
  None

Returns
  None

Others
  None

## ◆ setpin()

void MeMegaPiDCMotor::setpin | ( | uint8_t | dc_dir_h1,
|  | uint8_t | dc_dir_h2,
|  | uint8_t | pwm_pin
| ) |  |

Function
  setpin

Description
  Reset the DC motor available PIN by its arduino port.

Parameters

  [in] | dc_dir_h1 | - arduino port for direction pin1
  [in] | dc_dir_h2 | - arduino port for direction pin2
  [in] | pwm_pin | - arduino port for pwm input(should analog pin)

Output
  None

Returns
  None

Others
  None

## ◆ stop()

void MeMegaPiDCMotor::stop | ( | void |  | ) |

Function
  stop

Description
  Stop the rotation of the motor

Output
  None

Returns
  None

Others
  None

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

- src/MeMegaPiDCMotor.h
- src/MeMegaPiDCMotor.cpp