Created
January 10, 2019 20:22
-
-
Save falsovsky/8b8667788917ac874538ae4ab59e5b77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <gpiod.h> | |
int main(int argc, char *argv[]) { | |
int status = 0; | |
// Check for root! | |
if (geteuid() == 0) { | |
for(;;) { | |
gpiod_ctxless_set_value("gpiochip0", 12, status, 0, argv[0], NULL, NULL); | |
sleep(1); | |
status = !status; | |
} | |
} else { | |
printf("Please run as root\n"); | |
return EXIT_FAILURE; | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment