what is wrong in my simple keypad matrix sketch

sir,
i made this sketch for Teensy LC board. using keypad library.
2&3 pins are on Rotatry Encoder.encoder is working good according to Sketch.
please look a bit on My sketch and attachment image .

#include <Keypad.h>
#include <Encoder.h> 


const byte ROWS = 3; //four rows
const byte COLS = 12; //four columns
char keys[ROWS][COLS] = {
{1,2,3,4,5,6,7,8,9,10,11,12},
{13,14,15,16,17,18,19,20,21,22,23,24},
{25,26,27,28,29,30,31,32,33,34,35,36}
};
byte rowPins[ROWS] = {4, 5, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

Encoder myEnc(2, 3);      // which pins are connected to Encoder                                    
String msg;

void setup() {
  Mouse.screenSize(1366, 768);   //   Screen resolutions of your display (check from control panel)                                
 Serial.begin(9600);
   msg = "";
}

long oldPosition  = -999;  

void loop() {
  long newPosition = myEnc.read();   // ----------------------------------------------------------------------------------------------------------------------------------------- 
  if (newPosition > oldPosition) {   
    oldPosition = newPosition;        
     Mouse.moveTo(512, 54);    //  put here action to be, when Encoder is rotated upward  
    Mouse.scroll(-1);           
    Mouse.moveTo(345, 94);
   }
   if (newPosition < oldPosition) {   
    oldPosition = newPosition;       
     Mouse.moveTo(512, 54);     //  put here action to be, when Encoder is rotated Downward   
    Mouse.scroll(+1);          
    Mouse.moveTo(345, 94);
   }   // ----------------------------------------------------------------------------------------------------------------------------------------- -----------------------------
 if (kpd.getKeys())
    {
        for (int i=0; i<LIST_MAX; i++)   // Scan the whole key list.
        {
            if ( kpd.key[i].stateChanged )   // Only find keys that have changed state.
            {
                switch (kpd.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
                    case PRESSED:
                    msg = " PRESSED.";
                break;
                    case HOLD:
                    msg = " HOLD.";
                break;
                    case RELEASED:
                    msg = " RELEASED.";
                break;
                    case IDLE:
                    msg = " IDLE.";
                }
                Serial.print("Key ");
                Serial.print(kpd.key[i].kchar);
                Serial.println(msg);
            }
        }
    }

}

when 3rd rowPIN6 is connected to 11th colPIN17 or 12th colPIN18, output is coming like ($,#,") instead of 35 and 36.

please find where is wrong???

Have you checked, for example, what the decimal value of the ASCII character “#” or “$” might be?

Also, review what is actually meant by the act that results in “coming out”.

The hexadecimal value of '#' ought to be 23H and for '$', or '¤' vould be 24H if I'm not too corroded. Translate that to decimal!

23H

There are no H's in hexadecimal. You must be in some other base. If it has H as a digit then your number is too long.

The value is 23 and the 'H' is a standard way to point out that the value is expressed in hexadecimal notation. 'O' indicates Octal as the base and 'B' indicates binary.

Railroader:
The value is 23 and the 'H' is a standard way to point out that the value is expressed in hexadecimal notation. 'O' indicates Octal as the base and 'B' indicates binary.

That's terribly ambiguous. How are we to know whether the B is a digit or means binary?

The standard way at least in these languages is to put this stuff at the BEGINNING or the number.

0b0011 is binary

0x03 is hex

and

03 leading zero is octal.

As You know binary values concists of '0' and '1' only. 010111B would be, as I wrote, the same value as 23H. The notification You refere to I want to connect to the convention used in most computer programming languages to make the compiler happy.

Sir,. I am not expert in arduino . I want to use keypad library for 36 buttons in 3 rows and 12 col . If you can help me , please tell me . What changes in my sketch will return (kpd.key*.kchar) = 1....to ..36 , according to button. Not any other unknown character or value????? Because if*
kpd.key*.kchar = 1..to36. Can be used as integer ,if need ????*

Sir,. I am not expert in arduino.

We don't expect people to be, but we do expect people to follow up on suggestions, like that given in reply #1.

As the tiniest bit of Google research would lead you to understand, the decimal value of the ASCII character '#' is 35, hexadecimal value is 23. They are equivalent representations of the binary value stored in the computer.

If you use the command

Serial.print(kpd.key[i].kchar);

a # is printed.

You can use this command to see the decimal value

Serial.print(kpd.key[i].kchar, DEC);

or this command

Serial.print((int) kpd.key[i].kchar);

To see the hex value use this command:

Serial.print(kpd.key[i].kchar, HEX);

Homework: read up on variable types and casts.

Delta_G:
That's terribly ambiguous. How are we to know whether the B is a digit or means binary?

Not ambiguous at all: If it isn't followed by an H it means Binary. This was the style used by many assembly languages.

jremington:
We don't expect people to be, but we do expect people to follow up on suggestions, like that given in reply #1.

As the tiniest bit of Google research would lead you to understand, the decimal value of the ASCII character '#' is 35, hexadecimal value is 23. They are equivalent representations of the binary value stored in the computer.

If you use the command

Serial.print(kpd.key[i].kchar);

a # is printed.

You can use this command to see the decimal value

Serial.print(kpd.key[i].kchar, DEC);

or this command

Serial.print((int) kpd.key[i].kchar);

To see the hex value use this command:

Serial.print(kpd.key[i].kchar, HEX);

Homework: read up on variable types and casts.

thank you sir, jremington . Your functions helped me ,to get int value .and It is easy to use as single line.so thank you very much..