本文整理汇总了C++中Gpio::start方法的典型用法代码示例。如果您正苦于以下问题:C++ Gpio::start方法的具体用法?C++ Gpio::start怎么用?C++ Gpio::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gpio
的用法示例。
在下文中一共展示了Gpio::start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_test
int do_test()
{
Gpio gpio;
if (gpio.start() < 0) {
return -1;
}
gpio.configgpio(LED_CNF | LED_pinR);
gpio.configgpio(LED_CNF | LED_pinG);
gpio.configgpio(LED_CNF | LED_pinB);
gpio.gpiowrite(LED_pinR, LED_OFF);
gpio.gpiowrite(LED_pinG, LED_OFF);
gpio.gpiowrite(LED_pinB, LED_OFF);
printf("off\n");
sleep(2);
gpio.gpiowrite(LED_pinR, LED_ON);
gpio.gpiowrite(LED_pinG, LED_OFF);
gpio.gpiowrite(LED_pinB, LED_OFF);
printf("red\n");
sleep(2);
gpio.gpiowrite(LED_pinR, LED_OFF);
gpio.gpiowrite(LED_pinG, LED_ON);
gpio.gpiowrite(LED_pinB, LED_OFF);
printf("green\n");
sleep(2);
gpio.gpiowrite(LED_pinR, LED_OFF);
gpio.gpiowrite(LED_pinG, LED_OFF);
gpio.gpiowrite(LED_pinB, LED_ON);
printf("blue\n");
sleep(2);
gpio.gpiowrite(LED_pinR, LED_OFF);
gpio.gpiowrite(LED_pinG, LED_OFF);
gpio.gpiowrite(LED_pinB, LED_OFF);
printf("off\n");
gpio.stop();
return 0;
}