This library allows an Aduino board to interface with a 5 button ADKeyboard with minimal boiler plate code.
Download this repo as a ZIP, and use the Arduino IDE to import it
-
Sketch > Include Library > Add .ZIP Library
// Include the library
#include <ADKeyboard.h>
// Create a new keyboard instance passing the analog pin that the OUT pin on the ADKeyboard device is connected to. EG: A0
ADKeyboard kb(A0);
// Get which pin was pressed 1..5, or 0 for no press
int pressed = kb.pressed();
// Alternative usage, pass a pin and check the result, if it was pressed then returns true
bool btn1_pressed = kb.pressed(1);
// Alternative, direct usage, pass a pin and get which pin was pressed 1..5, or 0 for no press, EG: A0
int pressed = ADKeyboardState(A0);
Use the Arduino IDE to open the supplied example code.
-
File > Examples > ADKeyboard > example1
Copyright (c) Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA