Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "sysfs-gpio.h"
- #include <stdio.h>
- // #include <unistd.h>
- int main()
- {
- struct Gpio gpio = GPIO_INITIALIZER;
- gpio_open_output( &gpio, "/dev/gpio/relay-jp3", "low" );
- gpio_open( &gpio, "/dev/gpio/relay-jp3", "low" );
- if( gpio_is_output( &gpio ) ) {
- gpio_write( &gpio, 0 );
- } else {
- gpio_set_direction_output( &gpio, "high" );
- }
- gpio_set_direction_output(&gpio, "low");
- int const timeout_ms = 3000; // -1 = no timeout
- printf( "Print in %d milliseconds.\n ", timeout_ms );
- gpio_close( &gpio );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement