Skip to content

Instantly share code, notes, and snippets.

@falsovsky
Created January 10, 2019 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falsovsky/8b8667788917ac874538ae4ab59e5b77 to your computer and use it in GitHub Desktop.
Save falsovsky/8b8667788917ac874538ae4ab59e5b77 to your computer and use it in GitHub Desktop.
#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