1#ifndef J_ENCODER_BSED_H
2#define J_ENCODER_BSED_H
5#include <byte-sized-encoder-decoder.h>
13 ByteSizedEncoderDecoder&
bsed;
30 JEncoderBSED(ByteSizedEncoderDecoder& _bsed,
byte _encoderChannel,
bool _reverse =
false,
float _distPerCountFactor = 1.0, int16_t _slowestIntervalMicros = 0, int16_t _encoderEnoughCounts = 0)
41 bsed.setEncoderSlowestInterval(_encoderChannel, _slowestIntervalMicros);
42 bsed.setEncoderEnoughCounts(_encoderChannel, _encoderEnoughCounts);
reads a quadrature (incremental) encoder that is connected to a Byte Sized Encoder Decoder board conn...
Definition JEncoderBSED.h:10
long getCounter()
returns how far the encoder has turned from the zero position
Definition JEncoderBSED.h:54
float getDistPerCountFactor()
returns a conversion factor between encoder ticks and distance that can be set for the encoder
Definition JEncoderBSED.h:62
byte encoderChannel
Definition JEncoderBSED.h:14
void setReverse(bool _reverse)
reverse readings of encoder
Definition JEncoderBSED.h:75
void setDistPerCountFactor(float _factor)
set the conversion factor between encoder ticks and distance
Definition JEncoderBSED.h:66
JEncoderBSED(ByteSizedEncoderDecoder &_bsed, byte _encoderChannel, bool _reverse=false, float _distPerCountFactor=1.0, int16_t _slowestIntervalMicros=0, int16_t _encoderEnoughCounts=0)
constructor, sets pins and settings
Definition JEncoderBSED.h:30
void run()
if an encoder needs to have some code called each loop (like absolute encoder polling encoder and cal...
Definition JEncoderBSED.h:91
float getVel()
calculates velocity in distance per second where distance was set by setdistPerCountFactor()
Definition JEncoderBSED.h:50
int32_t zeroVal
Definition JEncoderBSED.h:17
float distPerCountFactor
Definition JEncoderBSED.h:15
long zeroCounter()
reset the counter of how far the encoder has turned
Definition JEncoderBSED.h:45
int8_t reverse
Definition JEncoderBSED.h:16
float getPos()
returns how far the encoder has turned from the zero position converted to distance
Definition JEncoderBSED.h:58
bool hasDirection()
can this encoder measure direction or just speed
Definition JEncoderBSED.h:83
ByteSizedEncoderDecoder & bsed
Definition JEncoderBSED.h:13
bool isVelNew()
could be useful for only recalculating a control loop if there's new velocity data
Definition JEncoderBSED.h:87
defines common interface for JEncoder
Definition JEncoder.h:33