made quadrature encoder setup little easyer

This commit is contained in:
Alexander Richter 2023-08-25 07:33:15 +02:00
parent f45a9c0276
commit 0fdc117b74

View File

@ -134,8 +134,7 @@ Note that Analog Pin numbering is different to the Print on the PCB.
#ifdef QUADENC #ifdef QUADENC
#include <Encoder.h> #include <Encoder.h>
const int QuadEncs = 2; //how many Rotary Encoders do you want? #define QUADENCS 2 //how many Rotary Encoders do you want?
#define QUADENCS 2 //You have to set it twice unfortunately...
// Encoders have 2 signals, which must be connected to 2 pins. There are three options. // Encoders have 2 signals, which must be connected to 2 pins. There are three options.
@ -318,6 +317,21 @@ const int debounceDelay = 50;
#ifdef KEYPAD #ifdef KEYPAD
byte KeyState = 0; byte KeyState = 0;
#endif #endif
#if QUADENC == 1
const int QuadEncs = 1;
#endif
#if QUADENC == 2
const int QuadEncs = 2;
#endif
#if QUADENC == 3
const int QuadEncs = 3;
#endif
#if QUADENC == 4
const int QuadEncs = 4;
#endif
#if QUADENC == 5
const int QuadEncs = 5;
#endif
#ifdef QUADENC #ifdef QUADENC
long EncCount[QuadEncs]; long EncCount[QuadEncs];
long OldEncCount[QuadEncs]; long OldEncCount[QuadEncs];