B4R Question rKeypad and ESP32S

Mostez

Well-Known Member
Licensed User
Longtime User
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

B4X:
Sub Process_Globals
    Public Serial1 As Serial
    Private pad As Keypad
    Private password As String = "123456" 'the password is *123456
    Private passwordBuffer(6) As 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(25, 26, 27, 14),  Array As Byte(34, 35, 32, 33),"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
 

Attachments

  • ESP32-Pinout.jpg
    ESP32-Pinout.jpg
    51.6 KB · Views: 161

tigrot

Well-Known Member
Licensed User
Longtime 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:
Upvote 0
Top