Written by Larry Bank (bitbank@pobox.com)
This example project shows how to blink the Arduino Uno Q's LEDs from the Linux side using native C++ code. It also provides a blueprint for creating wrapper functions to use Arduino-like APIs on Linux.
Before you can build the project, you'll need to install a few packages on Linux:
sudo apt install libgpiod-dev make g++ -y
now you can type 'make'
Wait...before you can control the user LEDs with direct GPIO access, you need
to disable the leds-gpio system driver that's installed. This driver takes
control of the LEDs and presents a different way of controlling them. To
disable this driver, type the following:
sudo su
echo leds > /sys/bus/platform/drivers/leds-gpio/unbind
After you're finished experimenting with this program you can re-enable the sysfs driver by rebooting the Uno Q
If you've done the above steps and disabled the sysfs leds driver, then you
can start the program by typing ./native_blink
The red LED should now blink continuously until you hit ctrl-C to quit