JMotor
Loading...
Searching...
No Matches
JEncoderQuadratureAttachInterrupt.h
Go to the documentation of this file.
1#ifndef J_ENCODER_QUADRATURE_ATTACH_INTERRUPT_H
2#define J_ENCODER_QUADRATURE_ATTACH_INTERRUPT_H
4#include <Arduino.h>
12
13public:
22 JEncoderQuadratureAttachInterrupt(byte _encoderAPin, byte _encoderBPin, float _distPerCountFactor = 1.0, bool _reverse = false, unsigned long _slowestIntervalMicros = 100000UL)
23 : JEncoderQuadrature(_encoderAPin, _encoderBPin, _distPerCountFactor, _reverse, _slowestIntervalMicros)
24 {
25 }
26
27 void setUpInterrupts(void (*_isrAPointer)(void), void (*_isrBPointer)(void))
28 {
29
30 pinMode(encoderAPin, INPUT);
31 pinMode(encoderBPin, INPUT);
32
33 attachInterrupt(encoderAPin, _isrAPointer, CHANGE);
34 attachInterrupt(encoderBPin, _isrBPointer, CHANGE);
35 }
37 {
38 detachInterrupt(encoderAPin);
39 detachInterrupt(encoderBPin);
40 }
41};
42#endif
uses attachInterrupt() platform: esp32, teensy (could be used with standard avr arduinos but only wit...
Definition JEncoderQuadratureAttachInterrupt.h:11
JEncoderQuadratureAttachInterrupt(byte _encoderAPin, byte _encoderBPin, float _distPerCountFactor=1.0, bool _reverse=false, unsigned long _slowestIntervalMicros=100000UL)
constructor, sets pins and settings
Definition JEncoderQuadratureAttachInterrupt.h:22
void turnOffInterrupts()
disable interrupts and stop monitoring encoder
Definition JEncoderQuadratureAttachInterrupt.h:36
void setUpInterrupts(void(*_isrAPointer)(void), void(*_isrBPointer)(void))
set up pins and interrupts
Definition JEncoderQuadratureAttachInterrupt.h:27
reads a quadrature (incremental) encoder
Definition JEncoderQuadrature.h:13
byte encoderBPin
Definition JEncoderQuadrature.h:17
byte encoderAPin
Definition JEncoderQuadrature.h:16