Example: get state of a button. More...
#include "stdio.h"#include <termios.h>#include <unistd.h>#include <errno.h>#include <sys/types.h>#include <sys/time.h>#include "libpruio/pruio.h"#include "libpruio/pruio_pins.h"
Go to the source code of this file.
Macros | |
| #define | _GNU_SOURCE 1 |
| Message for the compiler. | |
| #define | PIN P8_07 |
| The header pin to use. | |
Functions | |
| int | isleep (unsigned int mseconds) |
| Wait for keystroke or timeout. More... | |
| int | main (int argc, char **argv) |
| The main function. More... | |
Example: get state of a button.
This file contains an example on how to use libpruio to get the state of a button connetect to a GPIO pin on the beaglebone board. Here pin 7 on header P8 is used as input with pullup resistor. Connect the button between P8_07 (GPIO input) and P8_01 (GND). Find a functional description in section button.
Licence: GPLv3, Copyright 2014-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net
Compile by: gcc -Wall -o button2 button2.c -lpruio
Definition in file button2.c.
| int isleep | ( | unsigned int | mseconds | ) |