0

I need help figuring out how to use the raspberry pi gpio kit's buttons as regular keyboard inputs in C++.

If you don't understand, what I mean is that my club wants to use the raspberry pi's gpio kit and buttons to make a game controller, so when button 1 is pressed and C++ detects it, C++ will virtually press the up arrow as if you pressed it, button 2 = down arrow etc. but all in C++ maybe using the wiringPi.h header file?

While this is a club project to make an arcade machine, I am one of two people who know basic C++ and I am the only one that knows anything about the raspberry pi (even the club head is clueless) and I really need help before the school deadline, or else my school with have an arcade machine with no controls...

  • Try `xdotools` library: [link](https://gordonlesti.com/c-language-trigger-key-events-in-linux-with-xdo/). Note that you will need to acquire target window handle somehow. – user3366592 Nov 03 '21 at 12:46
  • If you are using Linux, enable them via Device Tree (and accompanying `gpio-keys` driver and use `libinput`. This is how it's designed to be used. – 0andriy Nov 03 '21 at 19:39

0 Answers0