Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Suggestions on connecting Membrane 1x4 Keypad to OrangePi PC+

Featured Replies

Hi Everyone.

 

I have been looking for a way to connect this keypad directly to my Orange Pi PC+ directly through gpio without resistors.

https://www.adafruit.com/product/1332

 

I also need software (hopefully either bash or python) to read a key press and then either run a script or perform a command.

 

If anyone here done this or even connected 1 switch to gpio (without resistors), could you please post the solution or a link to follow.

 

Thanks.

V

You can simply use GPIO internal pullups by enabling them.

By using orangepi_PC_gpio_pyH3 ( https://github.com/duxingkei33/orangepi_PC_gpio_pyH3), python code will look like :

from pyA20.gpio import gpio
from pyA20.gpio import port

gpio.setcfg(port.PA1, gpio.INPUT)
gpio.pullup(port.PA1, gpio.PULLUP)
if gpio.input(PA1) > 0:
    print "not pressed"
else:
    print "pressed"
  • Author

Thanks Man.

It is simple once you see it like you have written it.

On some other example I can see

import RPi.GPIO as GPIO

Is it as simple as swapping RPi.GPIO to pyA20.gpio and matching the correct pins?

V.

  • Author

I have this python matrix keypad working on my rpi and hope someone can help me convert it to pyA20.

Thanks again.

 

#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import os
from time import sleep

GPIO.setmode(GPIO.BOARD)
MATRIX= [[1,2,3],
         [4,5,6],
         [7,8,9],
         ["u",0,"d"]
         ]
ROW=[7,11,13,15]
COL=[12,16,18]

for j in range(3):
    GPIO.setup(COL[j],GPIO.OUT)
    GPIO.output(COL[j],1)

for i in range(4):
    GPIO.setup(ROW[i],GPIO.IN,pull_up_down = GPIO.PUD_UP)
try:
    while(True):
                for j in range(3):
                    GPIO.output(COL[j],0)
                    for i in range(4):
                        if GPIO.input(ROW[i]) == 0:
                         print MATRIX [i][j]
                         print "/usr/local/bin/" + str(MATRIX [i][j])+".sh"
                         a = str("/usr/local/bin/" + str(MATRIX [i][j])+".sh")
			 print a
			 os.system (a)
			 sleep(0.2);
			 time.sleep(0.2)
                         while (GPIO.input(ROW[i])==0):
                                pass

                    GPIO.output(COL[j],1)
except KeyboardInterrupt:
    GPIO.cleanup()

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.