Smart Car Controller  1.0
LIbrary to manage a Smart Car Robot
MD_MotorEncoder Class Reference

#include <MD_MotorEncoder.h>

Public Member Functions

Class constructor and destructor.
 MD_MotorEncoder (uint8_t pinInt)
 
 ~MD_MotorEncoder (void)
 
Methods for core object control.
bool begin (void)
 
void reset (void)
 
void read (uint32_t &interval, uint16_t &count, bool bReset=true)
 

Detailed Description

Core object for the MD_MotorEncoder class This class is a simple abstraction for DC motor encoder feedback.

Constructor & Destructor Documentation

◆ MD_MotorEncoder()

MD_MotorEncoder::MD_MotorEncoder ( uint8_t  pinInt)

Class Constructor.

Instantiate a new instance of the class.

The main function for the core object is to initialize the internal shared variables and timers to default values.

Parameters
pinIntThe interrupt pin for the encoder. This is digital pin that support interrupts.

◆ ~MD_MotorEncoder()

MD_MotorEncoder::~MD_MotorEncoder ( void  )

Class Destructor.

Release any allocated memory and clean up anything else.

Member Function Documentation

◆ begin()

bool MD_MotorEncoder::begin ( void  )

Initialize the object.

Initialize the object data. This needs to be called during setup() to initialize new data for the class that cannot be done during the object creation.

Returns
false if the pin specified is not an interrupt pin.

◆ read()

void MD_MotorEncoder::read ( uint32_t &  interval,
uint16_t &  count,
bool  bReset = true 
)

Read encoder values.

Returns the encoder accumulated count and the time period over which it was accumulated, and resets the two registers.

Parameters
intervalvariable for the time interval.
countvariable for the accumulator count.
bResetif true (f=default) rset the counters, otherwise leave them as they are.

◆ reset()

void MD_MotorEncoder::reset ( void  )

Reset the encoder.

This sets the encoder counter back to 0 and the the time marker to 'now'.


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