Smart Car Controller  1.0
Library to manage a two wheeled robotic vehicle (DC Motors)
SC_MotorEncoder Class Reference

#include <SC_MotorEncoder.h>

Public Member Functions

Class constructor and destructor.
 SC_MotorEncoder (uint8_t pinInt)
 
 ~SC_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 SC_MotorEncoder class This class is a simple abstraction for DC motor encoder feedback.

Constructor & Destructor Documentation

◆ SC_MotorEncoder()

SC_MotorEncoder::SC_MotorEncoder ( uint8_t  pinInt)

Class Constructor.

Instantiate a new instance of the class.

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

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

◆ ~SC_MotorEncoder()

SC_MotorEncoder::~SC_MotorEncoder ( void  )

Class Destructor.

Release any allocated memory and clean up anything else.

Member Function Documentation

◆ begin()

bool SC_MotorEncoder::begin ( void  )

Initialize the object.

Initialize the object data. This needs to be called during setup() to reset 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 SC_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 registers if required.

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

◆ reset()

void SC_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: