B4R Question rKeypad and ESP32S

Discussion in 'B4R Questions' started by Mostez, May 20, 2019.

  1. Mostez

    Mostez Active Member

    Hello,
    I connected 4x4 keypad to ESP32S board but I get no response, used pins are (34,35,32,33,26,26,27,14) any ideas?

    Thnaks

    Code:
    Sub Process_Globals
        
    Public Serial1 As Serial
        
    Private pad As Keypad
        
    Private password As String = "123456" 'the password is *123456
        Private passwordBuffer(6As Byte
        
    Private passwordIndex As Int
        
    Private bc As ByteConverter
    End Sub

    Private Sub AppStart
        Serial1.Initialize(
    115200)
        
    Log("AppStart")
        pad.Initialize(
    "123A456B789C*0#D"Array As Byte(25262714),  Array As Byte(34353233),"pad_KeyPressed")
        
    'pad.Initialize("123A456B789C*0#D", Array As Byte(32, 33, 25, 26),  Array As Byte(36, 39, 34, 35),"pad_KeyPressed")
        
    End Sub

    Sub Pad_KeyPressed (Key As String)
        
    Log(Key) 'for debug only
        If Key = "*" Then
            passwordIndex = 
    0
            
    'this is not really required, but it makes the logs nicer.
            bc.ArrayCopy("000000", passwordBuffer)
        
    Else if passwordIndex < passwordBuffer.Length Then
            
    'put the key in the buffer.
            passwordBuffer(passwordIndex) = Asc(Key)
            passwordIndex = passwordIndex + 
    1
            
    If passwordIndex = passwordBuffer.Length Then
                
    If passwordBuffer = password Then
                    
    Log("Well done!!!")
                
    End If
            
    End If
        
    End If
        
    Log(passwordBuffer)
    End Sub
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    Does it work with a regular Arduino?
     
  3. Mostez

    Mostez Active Member

  4. Erel

    Erel Administrator Staff Member Licensed User

  5. tigrot

    tigrot Well-Known Member Licensed User

    Is a pullup present on keyboard pins? Maybe the pins used are non pullup capable...
     
  6. tigrot

    tigrot Well-Known Member Licensed User

    I have found that that 34,35,36 and 39 are input only(at least on some flavour of ESP32), since they are assigned to column and column is the source for keyboard scan(is set to output and put high), you need to reassign the keyboard pins to digital pins capable of both Input and Output.
    https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
     
    Last edited: May 22, 2019
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice