Makeblock-library-for-Arduino  V3.2.4
It's a library for arduino application developers
Classes | Macros | Typedefs | Variables
MeEncoderOnBoard.h File Reference

Header for MeEncoderOnBoard.cpp module. More...

#include <Arduino.h>
#include <stdbool.h>
#include <avr/interrupt.h>

Go to the source code of this file.


struct  PID_internal
struct  Me_Encoder_type
struct  Encoder_port_type
class  MeEncoderOnBoard
 Driver for Encoder module on MeAuriga and MeMegaPi. More...


#define DIRECT_MODE   0x00
#define PID_MODE   0x01
#define PWM_MODE   0x02
#define MOTION_WITH_POS   0x00
#define MOTION_WITHOUT_POS   0x01
#define PWM_MIN_OFFSET   25


typedef void(* cb) (int16_t, int16_t)


Encoder_port_type encoder_Port [6]

Detailed Description

Header for MeEncoderOnBoard.cpp module.

This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license
conditions. The main licensing options available are GPL V2 or Commercial:
Open Source Licensing GPL V2
This is the appropriate option if you want to share the source code of your
application with everyone you distribute it to, and you also want to give them
the right to share who uses it. If you wish to use this software under Open
Source Licensing, you must contribute all your source code to the open source
community in accordance with the GPL Version 2 when your application is
distributed. See
This file is a drive for Encoder On MeAuriga and MeMegaPi.
Method List:
  1. void MeEncoderOnBoard::reset(uint8_t slot);
  2. uint8_t MeEncoderOnBoard::getSlotNum(void);
  3. uint8_t MeEncoderOnBoard::getIntNum(void);
  4. uint8_t MeEncoderOnBoard::getPortA(void);
  5. uint8_t MeEncoderOnBoard::getPortB(void);
  6. long MeEncoderOnBoard::getPulsePos(void);
  7. void MeEncoderOnBoard::setPulsePos(long pulse_pos);
  8. void MeEncoderOnBoard::pulsePosPlus(void);
  9. void MeEncoderOnBoard::pulsePosMinus(void);
  10. void MeEncoderOnBoard::setCurrentSpeed(float speed);
  11. float MeEncoderOnBoard::getCurrentSpeed(void);
  12. int16_t MeEncoderOnBoard::getCurPwm(void);
  13. void MeEncoderOnBoard::setTarPWM(int16_t pwm_value);
  14. void MeEncoderOnBoard::setMotorPwm(int16_t pwm);
  15. void MeEncoderOnBoard::updateSpeed(void);
  16. void MeEncoderOnBoard::updateCurPos(void);
  17. long MeEncoderOnBoard::getCurPos(void)
  18. void MeEncoderOnBoard::runSpeed(float speed);
  19. void MeEncoderOnBoard::setSpeed(float speed);
  20. void MeEncoderOnBoard::move(long position,float speed,int16_t extId,cb callback);
  21. void MeEncoderOnBoard::moveTo(long position,float speed,int16_t extId,cb callback);
  22. long MeEncoderOnBoard::distanceToGo(void);
  23. void MeEncoderOnBoard::setSpeedPid(float p,float i,float d);
  24. void MeEncoderOnBoard::setPosPid(float p,float i,float d);
  25. void MeEncoderOnBoard::setPulse(int16_t pulseValue);
  26. void MeEncoderOnBoard::setRatio(int16_t RatioValue);
  27. void MeEncoderOnBoard::setMotionMode(int16_t motionMode);
  28. int16_t MeEncoderOnBoard::pidPositionToPwm(void);
  29. int16_t MeEncoderOnBoard::speedWithoutPos(void);
  30. void MeEncoderOnBoard::encoderMove(void);
  31. void MeEncoderOnBoard::pwmMove(void);
  32. boolean MeEncoderOnBoard::isTarPosReached(void);
  33. void MeEncoderOnBoard::loop(void);
<Author>         <Time>        <Version>        <Descr>
Mark Yan         2015/12/15     1.0.0            Build New
Mark Yan         2016/04/07     1.0.1            fix motor reset issue.
Mark Yan         2016/05/17     1.0.2            add some comments.
Mark Yan         2016/06/25     1.0.3            add PID calibration for encoder driver.

Macro Definition Documentation

#define DIRECT_MODE   0x00
#define MOTION_WITH_POS   0x00
#define MOTION_WITHOUT_POS   0x01
#define PID_MODE   0x01
#define PWM_MIN_OFFSET   25
#define PWM_MODE   0x02

Typedef Documentation

typedef void(* cb) (int16_t, int16_t)

Variable Documentation

Encoder_port_type encoder_Port[6]