Programming a C / C++ code to Control LEDS existing on BeagleBoneBlack using BUTTON integrated on the Board

Hello BBB users. Is there anyone here who developped a C or C++ code which make it possible to Control LED using Button integrated both in the board through GPIO ? Please help me.

This example shows how to control a user LED (LED3):

http://users.freebasic-portal.de/tjf/Projekte/libpruio/doc/html/sos_8c_source.html

This example shows how to read the state of a button:

http://users.freebasic-portal.de/tjf/Projekte/libpruio/doc/html/button2_8c_source.html

The only onboard button connected to a GPIO is the boot button, wired to P8_43. So you have to adapt #define PIN P8_43. And since the button switches GND, you should use a pull-up resistor: if (pruio_gpio_config(io, PIN, PRUIO_GPIO_IN_1)) {…

Merge both examples together and off you go.