Koduino
|
Quadrature encoder library. More...
#include <Encoder.h>
Quadrature encoder library.
Copyright (C) Ghost Robotics - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential Written by Avik De avik@ ghos trobo tics .io
Public Member Functions | |
void | init (uint8_t pin1, uint8_t pin2, uint16_t maxCount) |
Initialize the quadrature encoder. More... | |
uint16_t | read (void) |
Read the current encoder count. More... | |
void | write (uint16_t val) |
Set the current encoder count. More... | |
void Encoder::init | ( | uint8_t | pin1, |
uint8_t | pin2, | ||
uint16_t | maxCount | ||
) |
Initialize the quadrature encoder.
This function configures the pins, and starts the timer connected to them. NOTE: pin1 and pin2 must be channels 1 and 2 of hardware timer 2, 3, 4, 5, or 19 on the F373. To check this, you have to look at the datasheet. Additionally, if not using the default pin mapping, you will have to call pinRemap() before calling this function (see example above).
pin1 | Pin connected to signal A or B |
pin2 | Pin connected to signal B or A |
maxCount | The max number of ticks (set according to encoder chip specification). Caution: Counting starts at 0, so for example for a 12-bit encoder set to 4095. |
Copyright (C) Ghost Robotics - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential Written by Avik De avik@ ghos trobo tics .io
|
inline |
Read the current encoder count.
|
inline |
Set the current encoder count.
Used to (for example) set the "zero" point
val |