# Thread: How to vonnct many rotay encoders

1. ## How to vonnct many rotay encoders

I started to build radio panel and MCP based on Arduino mega and Jim Link2FS,I am modifying fim code for multi ratio bit by bit.
So I got my LCD set up,I got switches end I started with the encoders,

The first one was easy,made small modification to Jim code and it worked,but the second one wont send the data it should

So we got:

int X;// a rotary variable com1 1st encoder
int Xold;// the old reading com1 1st encoder
int Xdif;// the difference since last loop com1 1st encoder
int X1;// a rotary variable nav1 2nd encoder
int Xold1;// the old reading nav1 2nd encoder
int Xdif1;// the difference since last loop na 2nd encoder

void loop() {

{INPUTPINS();} //Check the "button pressed" section
}
void ROTARYS() {//now the bit for the rotary encoder input
if (X != Xold) { // checks to see if it different
(Xdif = (X-Xold));// finds out the difference

// Com1 rotary encoder output
if (Xdif == 1) {
Serial.println("A02");
}
else Serial.println("A04");
}
if (Xdif == -1) {
Serial.println("A01");
}
else Serial.println("A03");
}

if (X1 != Xold1) { // checks to see if it different
(Xdif1 = (X1-Xold1));// finds out the difference

// Com1 rotary encoder output
if (Xdif1 == 1) {
Serial.println("A13");
}
else Serial.println("A15");
}
if (Xdif1 == -1) {
Serial.println("A14");
}
else Serial.println("A16");
}
}

Now the 2nd encoder is connected to pin 22,23 and switch to 35
it send data like D220,D230 and so on,but it will not sen the command A14,A13 and so on.
I am guessing that it's something with the line

I look all over the internet and I ca not find what does position() do in relation to encoders.

2. ## Re: How to vonnct many rotay encoders

You have not posted the entire code, so I'm guessing.
But as it sends data like D220,D230, I would think that the encoder is connected to pins that are defined as KEYS, and and is therefore seen as a switch.
Have a look in the setup at the:
Code:
Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";
for (int KoutPin = 8; KoutPin < 70; KoutPin++)// Get all the pins ready for "Keys"
And change to whatever fits your setup.
Also change in the "void KEYS" section.

3. ## Re: How to vonnct many rotay encoders

I don't think it's that
In my code the pins from 8 o 54 ar set as outputs,and encode is a set of 2 switches anyway.
It is etected it is orking but for some season it does not want to send the comands A
here is the whole code that i got so far

/*

======================================================

This sketch prints the airspeed, altitude,
com1. frequency and com1. standby frequency to the LCD.

It is set up to use with the Uno card but it will also run as-is on the Mega using
the pins up to No. 19.
If you have a Mega card and want all the pins, then
there are only 3 things to change,,,
where it says <= 19 change that to read <= 69 (on 2 lines)
also,,
stringoldstate = "1111111111111111 etc" you need to have the appropriate one active.

=======================================================

This example code is in the public domain.

*/

// include the library code:

#include
#include "math.h"
#include

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

int mark; // shows where the cursor is in the likes of ADF etc
int active; // the mode thats active
int X;// a rotary variable com1
int Xold;// the old reading com1
int Xdif;// the difference since last loop com1
int X1;// a rotary variable nav1
int Xold1;// the old reading nav1
int Xdif1;// the difference since last loop nav1

int j1;
int j2;
int pinState;
int pinNo;
int doutpin;
String oldpinStateSTR, pinStateSTR, stringnewstate,stringoldstate, com1, com1old, com1sb, com1sbold, APairsp, APairspold,
APaltit, APaltitold,APhdg, APhdgold, VS, VSold, nav, navold, navsb,navsbold,trans, transold,mach, machold,
baro, baroold;

void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
delay (11);
lcd.print("Witaj Bartku");
delay (11);
lcd.setCursor(0, 1);
delay (11);
lcd.print("Czekam na dane z FSX");
delay (11);
// the line below is for the Uno card

//the line below is for the mega card
stringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";

Serial.begin(115200);
for (int doutPin = 8; doutPin <= 33; doutPin++)
{
pinMode(doutPin, INPUT);
digitalWrite(doutPin, HIGH);
}
Serial.flush();
delay(5000);
lcd.clear();

lcd.setCursor(6,1);
lcd.print("QNH");
}

void loop() {

{INPUTPINS();} //Check the "button pressed" section
{ROTARYS();} // go and check the rotary encoder

// read the oldest byte in the serial buffer:
if (Serial.available() > 0) {

if (j1 == 'k'){ // Found the reading "mach"
delay (0);
baro = "";
//pads it up to 5 caracters
if (baro != baroold){

lcd.setCursor(0, 1);
delay (0);
lcd.print(baro);
baroold = baro;
}
}

if (j1 == 'g'){ // Found the reading "mach"
delay (0);
mach = "";
//pads it up to 3 caracters
if (mach != machold){

lcd.setCursor(0, 0);
delay (0);
lcd.print(mach);
machold = mach;
}
}

if (j1 == 'f' ){ // Found the reading "airspeed indicated"
delay (0); // It seems to need a delay here
APairsp = "";
//pads it up to 3 caracters

if (APairsp != APairspold){ // checks to see if its different to the "old" reading

lcd.setCursor(0, 0); //sets the cursor position for the first letter
delay (0);
lcd.print(APairsp); //Prints the data to the LCD
APairspold = APairsp; // Writes the current reading to the "old" string.
lcd.setCursor(3, 0);
lcd.print(" ");

}
}

delay (11);
APhdg = "";
//pads it up to 3 caracters
if (APhdg != APhdgold){

lcd.setCursor(5, 0);
delay (11);
lcd.print(APhdg);
APhdgold = APhdg;
}
}

if (j1 == 'b'){ // Found the reading "altitude"
delay (11);
APaltit = "";

//pads it up to 5 caracters
if (APaltit != APaltitold){

lcd.setCursor(9, 0);
delay (11);
lcd.print(APaltit);
APaltitold = APaltit;
}
}

if (j1 == 'c'){ // Found the reading "VS"
delay (11);
VS = "";

//pads it up to 5 caracters
if (VS != VSold){

lcd.setCursor(15, 0);
delay (11);
lcd.print(VS);
VSold = VS;
}
}

if (j1 == 'A'){ // Found the reading "Com1 frequency"
delay (11);
com1 = "";
//pads it up to 7 caracters
if (com1 != com1old){

lcd.setCursor(0, 2);
delay (11);
lcd.print(com1);
com1old = com1;
}
}
if (j1 == 'B'){ // Found the reading "Com1 stand-by"
delay (11);
com1sb = "";
//pads it up to 7 caracters
if (com1sb != com1sbold){

lcd.setCursor(8, 2);
delay (11);
lcd.print(com1sb);
com1sbold = com1sb;
}
}
if (j1 == 'E'){ // Found the reading "nav1 stand-by"
delay (11);
nav = "";

//pads it up to 6 caracters
if (nav != navold){

lcd.setCursor(0, 3);
delay (11);
lcd.print(nav);
navold = nav;
}
}
if (j1 == 'F'){ // Found the reading "nav1 stand-by"
delay (11);
navsb = "";

//pads it up to 6 caracters
if (navsb != navsbold){
//delay (11);
lcd.setCursor(8, 3);
delay (11);
lcd.print(navsb);
navsbold = navsb;
}
}
if (j1 == 'J'){ // Found the reading "nav1 stand-by"
delay (11);
trans = "";

//pads it up to 4 caracters
if (trans != transold){
//delay (11);
lcd.setCursor(16, 3);
delay (11);
lcd.print(trans);
transold = trans;
}
}

} //end of serial loop
} //end of void loop

void ROTARYS() {//now the bit for the rotary encoder input
if (X != Xold) { // checks to see if it different
(Xdif = (X-Xold));// finds out the difference

// Com1 rotary encoder output
if (Xdif == 1) {
Serial.println("A02");
}
else Serial.println("A04");
}
if (Xdif == -1) {
Serial.println("A01");
}
else Serial.println("A03");
}

if (X1 != Xold1) { // checks to see if it different
(Xdif1 = (X1-Xold1));// finds out the difference

// Com1 rotary encoder output
if (Xdif1 == 1) {
Serial.println("A13");
}
else Serial.println("A15");
}
if (Xdif1 == -1) {
Serial.println("A14");
}
else Serial.println("A16");
}
}

}// end of rotarys

void INPUTPINS(){
// Now the bit for the "keys" input
stringnewstate = "";
for (int pinNo = 10; pinNo <= 53; pinNo++){// checks all the pins 10 to 53
oldpinStateSTR = "";
oldpinStateSTR += String(stringoldstate.charAt(pinNo - 10));
if (pinStateSTR != oldpinStateSTR) {// yes it's different
if (pinNo == 11 and pinStateSTR == "0") { //Change-over button is pressed
Serial.println("A06");//com1
}
if (pinNo == 31 and pinStateSTR == "0" ) { //Change-over button is pressed
Serial.println("A18");//com1
}
Serial.print ("D");
if (pinNo < 10) Serial.print ("0");
Serial.print (pinNo);
Serial.println (pinStateSTR);
delay(11);
}
stringnewstate += pinStateSTR;
}

stringoldstate = stringnewstate;
delay(11);

}

4. ## Re: How to vonnct many rotay encoders

I just drop things out of my head here
In you're void setup, you have got
Code:
Serial.begin(115200);
for (int doutPin = 8; doutPin <= 33; doutPin++)
You have got a rotary encoder on pin 8 and 9. Youre next rotary enoder 22 and 23, are in the "void INPUTPINS()" defined as a switch, because it is in the range between 10 and 53.
Code:
void INPUTPINS(){
// Now the bit for the "keys" input
stringnewstate = "";
for (int pinNo = 10; pinNo <= 53; pinNo++){// checks all the pins 10 to 53
Telling that the pins 10 to 53 are switches.
Change you're INPUTPINS range to:
int pinNo = 34; pinNo <= 53; pinNo++)
Plan which pins to be used for what.

EDIT:
Remember to change the entire statement.
Code:
for (int KpinNo = 34; KpinNo < 53; KpinNo++){    KpinStateSTR = String(digitalRead(KpinNo));
KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - 34));
if (KpinStateSTR != KoldpinStateSTR)

5. ## Re: How to vonnct many rotay encoders

Hi there
I made some chages,and tank you for pointing out my mystake
Anyway the encoder connected to pin 8, 9 works but the other 2 do not work.

Please have a look at my code,maybe yo find somthing

/*

======================================================

This sketch prints the airspeed, altitude,
com1. frequency and com1. standby frequency to the LCD.

It is set up to use with the Uno card but it will also run as-is on the Mega using
the pins up to No. 19.
If you have a Mega card and want all the pins, then
there are only 3 things to change,,,
where it says <= 19 change that to read <= 69 (on 2 lines)
also,,
stringoldstate = "1111111111111111 etc" you need to have the appropriate one active.

=======================================================

This example code is in the public domain.

*/

// include the library code:

#include
#include "math.h"
#include
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

int mark; // shows where the cursor is in the likes of ADF etc
int active; // the mode thats active
long Xold1;// the first encoder "old" reading
long Xold2;// the second encoder "old" reading
long Xold3;// the second encoder "old" reading

int j1;
int j2;
int pinState;
int pinNo;
int doutpin;
String oldpinStateSTR, pinStateSTR, stringnewstate,stringoldstate, com1, com1old, com1sb, com1sbold, APairsp, APairspold,
APaltit, APaltitold,APhdg, APhdgold, VS, VSold, nav, navold, navsb,navsbold,trans, transold,mach, machold,
baro, baroold;

void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
delay (11);
lcd.print("Witaj Bartku");
delay (11);
lcd.setCursor(0, 1);
delay (11);
lcd.print("Czekam na dane z FSX");
delay (11);
// the line below is for the Uno card

//the line below is for the mega card
stringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";

Serial.begin(115200);
for (int doutPin = 8; doutPin <= 54; doutPin++)
{
pinMode(doutPin, INPUT);
digitalWrite(doutPin, HIGH);
}
Serial.flush();
delay(5000);
lcd.clear();

lcd.setCursor(6,1);
lcd.print("QNH");
}

void loop() {

{
INPUTPINS();
} //Check the "button pressed" section
{
ROTARYS();
} // go and check the rotary encoder

// read the oldest byte in the serial buffer:
if (Serial.available() > 0) {

if (j1 == 'k'){ // Found the reading "mach"
delay (0);
baro = "";
//pads it up to 5 caracters
if (baro != baroold){

lcd.setCursor(0, 1);
delay (0);
lcd.print(baro);
baroold = baro;
}
}

if (j1 == 'g'){ // Found the reading "mach"
delay (0);
mach = "";
//pads it up to 3 caracters
if (mach != machold){

lcd.setCursor(0, 0);
delay (0);
lcd.print(mach);
machold = mach;
}
}

if (j1 == 'f' ){ // Found the reading "airspeed indicated"
delay (0); // It seems to need a delay here
APairsp = "";
//pads it up to 3 caracters

if (APairsp != APairspold){ // checks to see if its different to the "old" reading

lcd.setCursor(0, 0); //sets the cursor position for the first letter
delay (0);
lcd.print(APairsp); //Prints the data to the LCD
APairspold = APairsp; // Writes the current reading to the "old" string.
lcd.setCursor(3, 0);
lcd.print(" ");

}
}

delay (11);
APhdg = "";
//pads it up to 3 caracters
if (APhdg != APhdgold){

lcd.setCursor(5, 0);
delay (11);
lcd.print(APhdg);
APhdgold = APhdg;
}
}

if (j1 == 'b'){ // Found the reading "altitude"
delay (11);
APaltit = "";

//pads it up to 5 caracters
if (APaltit != APaltitold){

lcd.setCursor(9, 0);
delay (11);
lcd.print(APaltit);
APaltitold = APaltit;
}
}

if (j1 == 'c'){ // Found the reading "VS"
delay (11);
VS = "";

//pads it up to 5 caracters
if (VS != VSold){

lcd.setCursor(15, 0);
delay (11);
lcd.print(VS);
VSold = VS;
}
}

if (j1 == 'A'){ // Found the reading "Com1 frequency"
delay (11);
com1 = "";
//pads it up to 7 caracters
if (com1 != com1old){

lcd.setCursor(0, 2);
delay (11);
lcd.print(com1);
com1old = com1;
}
}
if (j1 == 'B'){ // Found the reading "Com1 stand-by"
delay (11);
com1sb = "";
//pads it up to 7 caracters
if (com1sb != com1sbold){

lcd.setCursor(8, 2);
delay (11);
lcd.print(com1sb);
com1sbold = com1sb;
}
}
if (j1 == 'E'){ // Found the reading "nav1 stand-by"
delay (11);
nav = "";

//pads it up to 6 caracters
if (nav != navold){

lcd.setCursor(0, 3);
delay (11);
lcd.print(nav);
navold = nav;
}
}
if (j1 == 'F'){ // Found the reading "nav1 stand-by"
delay (11);
navsb = "";

//pads it up to 6 caracters
if (navsb != navsbold){
//delay (11);
lcd.setCursor(8, 3);
delay (11);
lcd.print(navsb);
navsbold = navsb;
}
}
if (j1 == 'J'){ // Found the reading "nav1 stand-by"
delay (11);
trans = "";

//pads it up to 4 caracters
if (trans != transold){
//delay (11);
lcd.setCursor(16, 3);
delay (11);
lcd.print(trans);
transold = trans;
}
}

} //end of serial loop
} //end of void loop

void ROTARYS() {//now the bit for the rotary encoder input
if (X1 != Xold1) { // checks to see if it different
// Com1 rotary encoder output
if (X1 > Xold1) {
Serial.println("A02");
}
else Serial.println("A04");
}
if (X1 < Xold1) {
Serial.println("A01");
}
else Serial.println("A03");
}
if (quad1.position() > 1000){ // zero the rotary encoder count if too high or low
}
}
Xold1 = X1; // overwrites the old reading with the new one.
}
if (X2 != Xold2) { // checks to see if it different
// Com1 rotary encoder output
if (X2 > Xold2) {
Serial.println("A13");
}
else Serial.println("A15");
}
if (X2 < Xold2) {
Serial.println("A14");
}
else Serial.println("A16");
}
if (quad2.position() > 1000){ // zero the rotary encoder count if too high or low
}
}
Xold2 = X2; // overwrites the old reading with the new one.
}
if (X3 != Xold3) { // checks to see if it different
// Com1 rotary encoder output
if (X2 > Xold2)
Serial.println("B11");
if (X2 < Xold2)
Serial.println("B12");

if (quad2.position() > 1000){ // zero the rotary encoder count if too high or low
}
}
Xold2 = X2; // overwrites the old reading with the new one.
}
}// end of rotarys

void INPUTPINS(){
// Now the bit for the "keys" input
stringnewstate = "";
for (int pinNo = 10; pinNo <= 23; pinNo++){// checks all the pins 10 to 53
oldpinStateSTR = "";
oldpinStateSTR += String(stringoldstate.charAt(pinNo - 10));
if (pinStateSTR != oldpinStateSTR) {// yes it's different
if (pinNo == 11 and pinStateSTR == "0") { //Change-over button is pressed
Serial.println("A06");//com1
}
if (pinNo == 23 and pinStateSTR == "0" ) { //Change-over button is pressed
Serial.println("A18");//com1
}
Serial.print ("D");
if (pinNo < 10) Serial.print ("0");
Serial.print (pinNo);
Serial.println (pinStateSTR);
delay(11);
}
stringnewstate += pinStateSTR;
}

stringoldstate = stringnewstate;
delay(11);

}

6. ## Re: How to vonnct many rotay encoders

I'm a little confused here. It looks like you are mixing sketch for link2fs_inout and link2fs_multi. If you use Link2fs Multi, see in the programfolder for Link2fs_Multi. there you will find the "Multi_Keys_RotaryEncoders.ino" in the Demo iNOS folder.
Start with this Sketc and take one encoder at the time, see that it works before adding the next and/or adding functions to the encoder.
Removing and changing names and remarking / Description of the functions, before You understand the code, not so good idea.
Start the sketch using the things that is difficult, the encoders. Exclude all the things, not connected to the encoders. and get the encoders to work.

7. ## Re: How to vonnct many rotay encoders

You right am mixing in out and multi,I was thinking tat it would be straight thing to adjust it.
Anyway I will try that INO,
I was thinking about one more thing as well

pins 22 to 54 on arduino mega,as long as they are st as output and on HIGH they should not have a problem with encoders.
I am asking because all the examples have the encodes set in pin from 2 to 7 or so.

Anyway thank you one more time for you advice and help

8. ## Re: How to vonnct many rotay encoders

I tried the example you advice me
t does not work.
It works fine on pins 8 and 9

but if i o above 10 it gets nothing jst like the encoder is not there

/*
This code is in the public domain
Jimspage.co.nz
My thanks to the Guys that gave me snippets of code.

This sets the Arduino Mega card for 3 rotary encoders and "keys" input except pin 13.
Attach a switch to any pin from pin 8 upwards (except 13) and program that pin in "Multi"
Everything to do with "Keys" starts with a "K" in this code.
Everything to do with rotary encoders starts with a "R" in this code.
The Quadrature2 library is available from my site Jimspage.co.nz. (Special thanks to Bill Holland)
It's here ,, http://www.jimspage.co.nz/encoders2.htm (Near the bottom of the page)
Rotary encoder 1 is on pins 2 and 3
Rotary encoder 2 is on pins 4 and 5
Rotary encoder 3 is on pins 6 and 7
The "push" switch on each one is connected to a "Keys" input pin and just seen as a switch.

To change this to suit a Uno,, do the following ,,,,
Line 29 ,, change "70" to "20"
Line 117 ,, change "70" to "20"
That will make all the pins from pin 8 upwards on a Uno, as "Keys" input pins. (Except pin 13)

*/
#include "math.h"

int CodeIn;// used on all serial reads
int KpinNo;
int Koutpin;

String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;

int R;// a variable
int Rdif;// the difference since last loop
int R2;// a second test variable
int R3;// a second test variable
int Rold2;// a second loop old reading
int Rdif2; // the second test difference
int Rold3;// a second loop old reading
int Rdif3; // the second test difference

void setup()
{
Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";

for (int KoutPin = 40; KoutPin < 54; KoutPin++)// Get all the pins ready for "Keys"
{
pinMode(KoutPin, INPUT);
digitalWrite(KoutPin, HIGH);
}
Serial.begin(115200);
}

void loop() {
{KEYS();} //Check the "keys" section
{ENCODER();} //Check the Rotary Encoders
if (Serial.available()) {// Check if serial data has arrived from PC
CodeIn = getChar();
if (CodeIn == '=') {EQUALS();} // The first identifier is "="
if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
}

}

char getChar()// Get a character from the serial buffer
{
while(Serial.available() == 0);// wait for data
}

void EQUALS(){ // The first identifier was "="
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;

case 'B':
//Do something
break;

case 'C':
//Do something
break;

//etc etc etc
}
}

void LESSTHAN(){ // The first identifier was "<"
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;

case 'B':
//Do something
break;

case 'C':
//Do something
break;

//etc etc etc
}
}

void QUESTION(){ // The first identifier was "?"
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;

case 'B':
//Do something
break;

case 'C':
//Do something
break;

//etc etc etc
}
}
void SLASH(){ // The first identifier was "/" (Annunciator)
//Do something
}
void KEYS()
{
Kstringnewstate = "";
for (int KpinNo = 40; KpinNo < 54; KpinNo++){
KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - 40));
if (KpinStateSTR != KoldpinStateSTR)
{
if (KpinNo != 13){
Serial.print ("D");
if (KpinNo < 10) Serial.print ("0");
Serial.print (KpinNo);
Serial.println (KpinStateSTR);
}
}
Kstringnewstate += KpinStateSTR;
}
Kstringoldstate = Kstringnewstate;
}
void ENCODER(){
R =(quad1.position()/2); //The /2 is to suit the encoder(See my website)
if (R != Rold) { // checks to see if it different
(Rdif = (R-Rold));// finds out the difference
if (Rdif == 1) Serial.println ("A01");//Com1 Mhz down
if (Rdif == -1) Serial.println ("A02"); //Com1 Mhz up
Rold = R; // overwrites the old reading with the new one.
}
if (R2 != Rold2) {
(Rdif2 = (R2-Rold2));
if (Rdif2 == 1) Serial.println ("A03"); // Com1 Khz down
if (Rdif2 == -1) Serial.println ("A04");//Com1 Khz up
Rold2 = R2;
}
if (R3 != Rold3) {
(Rdif3 = (R3-Rold3));
if (Rdif3 == 1) Serial.println ("A55"); // VOR bug down
if (Rdif3 == -1) Serial.println ("A56"); //VOR bug up
Rold3 = R3;
}

}

9. ## Re: How to vonnct many rotay encoders

I just loaded your above INO and fitted 3 rotarys where it's indicated and it works fine.

Have a look at this thread ,,,

The reason that it is adjustable is, the higher you have it and if your INO is a large one ,, then there may be a speed impact on returns.
(No use scanning pins not involved with rotarys)
Soooo ,, if you are heading for a very long involved INO ,,, it's probably best to keep the Rotarys in the lower pin numbers.
In an average INO tho ,, it wont matter two hoots. (My rotarys are generally all in the range 24 to 40)

Jim

Edit ,,, Just to explain ,, it wont actually scan the non-rotary pins but the library still has to "roll" itself up, in the library's 'for' loop to the required maximum pin No.

10. ## Re: How to vonnct many rotay encoders

Hi there Jim
Thank you for all you help.
Well I had a small mishap yesterday I was rewirering my mega but when put it all togather it as not working.
Anyway now it's working but I have a new problem.

When I was uploading new sketch before the mishap my lcd was going off and then back on again.
ow It stays on all the time,the data on te display are updated but when I load the sketch that has no display in it,display still stays on with data from previous sketch.

As foo the encoders changed the bit in the library but still no result.

I thinking maybe I need to reset my mega or change tome settings.