Biblioteca Arduino ResistorKeypad.h

DESCARGAR LA BIBLIOTECA ResistorKeypad.h

Esta biblioteca de Arduino permite conectar de manera sencilla botoneras (de diferentes tamaños) a un Arduino usando un único pin analógico y unas resistencias.

Las resistencias deben estar conectadas a las teclas de manera que al presionar un botón se obtenga un valor diferente del de los demás botones (el valor no importa mientras que sea suficientemente distinto de los demás).

En lo que sigue se muestra un esquema de conexión de una posible botonera y de los programas que la controlan: uno para programarla y el otro para usarla.


DOWNLOAD the ResistorKeypad.h library

This Arduino library allows to easily connect keypads (of different sizes) to an Arduino using just a single Arduino analog pin and a set of resistors.

The resistors must be connected to the keys in such a way that pressing a button obtains a different value from the other keys (no matter which value as soon as it is different enough).

In the following a scheme of the conections of a keypad and two example programs: one to program the keypad and the second to use it.

Esquema
 


Configuration

#include <EEPROM.h>
#include <ResistorKeypad.h>

#define KEYBOARD_PIN  A0

// Keypad is in A0, 12 buttons 50 readings, save info at EEPROM address 100
ResistorKeypad rk(KEYBOARD_PIN, 12, 50, 100);

void setup() {
}

void loop() {
}


Use

#include <EEPROM.h>
#include <ResistorKeypad.h>

#define KEYBOARD_PIN  A0

// Keypad is in A0, and will get its info from EEPROM address 100 (previously saved with the other example)
ResistorKeypad rk(KEYBOARD_PIN, 100);

void setup() {
  Serial.begin(9600);
}

void loop() {
  int button = rk.getKey();
 
  Serial.println(button);
 
  delay(100);
}


 

LICENCIA

Copyright (C) 2013 Sergio Alonso (zerjioi@ugr.es)

ResistorKeypad.h Arduino library is free software: you can redistribute it  and/or modify it under the terms of the GNU General Public License as  published by the Free Software Foundation, either version 3 of the License,  or (at your option) any later version.

ResistorKeypad.h Arduino library is distributed in the hope that it will be  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ResistorKeypad.h Arduino library.  If not, see  http://www.gnu.org/licenses/