test_wiegand.c
Go to the documentation of this file.
1 #include <stdio.h>
2 
3 #include <pigpio.h>
4 
5 #include "wiegand.h"
6 
7 /*
8 
9 REQUIRES
10 
11 Wiegand contacts 0 and 1 connected to separate gpios.
12 
13 TO BUILD
14 
15 gcc -o wiegand_c test_wiegand.c wiegand.c -lpigpio -lrt
16 
17 TO RUN
18 
19 sudo ./wiegand_c
20 
21 */
22 
23 void callback(int bits, uint32_t value)
24 {
25  printf("bits=%d value=%u\n", bits, value);
26 }
27 
28 int main(int argc, char *argv[])
29 {
30  Pi_Wieg_t * w;
31 
32  if (gpioInitialise() < 0) return 1;
33 
34  w = Pi_Wieg(14, 15, callback, 5);
35 
36  sleep(300);
37 
38  Pi_Wieg_cancel(w);
39 
40  gpioTerminate();
41 }
42 
int gpioInitialise(void)
Definition: pigpio.c:8459
Pi_Wieg_t * Pi_Wieg(int gpio_0, int gpio_1, Pi_Wieg_CB_t callback, int timeout)
Definition: wiegand.c:84
void gpioTerminate(void)
Definition: pigpio.c:8495
void Pi_Wieg_cancel(Pi_Wieg_t *wieg)
Definition: wiegand.c:123
void callback(int bits, uint32_t value)
Definition: test_wiegand.c:23
int main(int argc, char *argv[])
Definition: test_wiegand.c:28


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57