本文整理汇总了C++中Gpio::pin方法的典型用法代码示例。如果您正苦于以下问题:C++ Gpio::pin方法的具体用法?C++ Gpio::pin怎么用?C++ Gpio::pin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gpio
的用法示例。
在下文中一共展示了Gpio::pin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
#include <iostream>
#include <csignal>
#include <cstdlib>
#include <sysio/clock.h>
#include <sysio/gpio.h>
using namespace std;
using namespace Sysio;
// <DANGER> Be careful !!! Before launching this program :
// -> Check that the pin below is well connected to an LED ! <-
const int ledPin = 0; // Header Pin 11: GPIO17 for RPi, GPIOA0 for NanoPi
Clock clk; // the clock of our program used for time calculation...
Gpio g; // our GPIO port
Pin & led = g.pin (ledPin); // led is a reference on pin 11 of the GPIO
// -----------------------------------------------------------------------------
// Signal Handler
static void
sighandler (int sig) {
g.close();
cout << endl << "everything was closed."<< endl << "Have a nice day !" << endl;
exit (EXIT_SUCCESS);
}
// -----------------------------------------------------------------------------
int main (int argc, char **argv) {