Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // output-example-basic: sysfs-gpio.c:146: gpio_is_output: Assertion `c == 'i' || c == 'o'' failed.
- // Aborted
- // Error from the lib!
- // Source below:
- #include "sysfs-gpio.h"
- #include <stdio.h>
- int main()
- {
- struct Gpio gpio = GPIO_INITIALIZER;
- gpio_open_output( &gpio, "/sys/class/leds/relay-jp3", 0 );
- int const timeout_ms = 3000; // -1 = no timeout
- gpio_open( &gpio, "/sys/class/leds/relay-jp3", 0 );
- if( gpio_is_output( &gpio ) ) {
- gpio_write( &gpio, 0 );
- } else {
- gpio_set_direction_output( &gpio, 1 );
- }
- printf( "Print in %d milliseconds.\n ", timeout_ms );
- gpio_close( &gpio );
- return 0;
- }
- // I changed some of the source to handle the GPIOs on the am335x to Relays for the RelayCape.
- Seth
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement