Combining the two best options mentioned—QuadEncoder.h and the built‑in RingBuf from SdFat—I put together the code below (with a bit of help from GPT). I’d appreciate your expertise on whether it’s correctly implemented.
The encoder stuff looks good, though I haven't tried to built your sketch. Rather than write your own ring buffer, which is tricky to get right, I always recommend using the RingBuf that is built into the SdFat library. It is interrupt-safe, so...
During printing no Position data will be buffered.
After printing the bufferWriteIndex is not reset, so no more data will be collected.
Setting up a second buffer might be enough to allow continued logging during prints, or a large enough...
Would this code with quadencoder.h library do the 1kHz sampling? and then add a circular buffer to write to SD.
#include "QuadEncoder.h"
const uint8_t ENCODER_MODULE = 1; // Use hardware ENC module 1 (options 1-4)
const uint8_t PIN_A = 2...
1)Not clear why the printing is needed? This was done to check any errors and check the feasibility of logging data of each individual encoder pulse and micros to SD card.
2)Perhaps only print when misses or problems occur? True, was more to...
Here are the results after testing with the buffer:
Using the buffer initially eliminates the timing and step‐miss issues.
However, once the buffer fills, prints its contents, and restarts, the next buffer cycle exhibits the same problem...
Hi all,
I’m testing an encoder‐reading sketch on a Teensy 4.1 and running into a couple of puzzling behaviors. Any help would be greatly appreciated!
What I’m seeing:
Step-count “jumps”
The encoder reading itself (using the Encoder...
Is there a module for input/output protection that provides the same level of reliability as a PLC? We're experiencing false triggering even with a pull-down resistor. Any recommendations?
Using Teensy 4.1