first re-commit.
This commit is contained in:
40
pigpio-master/EXAMPLES/CPP/WIEGAND_CODE/test_wiegand.cpp
Normal file
40
pigpio-master/EXAMPLES/CPP/WIEGAND_CODE/test_wiegand.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <pigpio.h>
|
||||
|
||||
#include "wiegand.hpp"
|
||||
|
||||
/*
|
||||
|
||||
REQUIRES
|
||||
|
||||
Wiegand contacts 0 and 1 connected to separate gpios.
|
||||
|
||||
TO BUILD
|
||||
|
||||
g++ -o wiegand_cpp test_wiegand.cpp wiegand.cpp -lpigpio -lrt
|
||||
|
||||
TO RUN
|
||||
|
||||
sudo ./wiegand_cpp
|
||||
|
||||
*/
|
||||
|
||||
void callback(int bits, uint32_t value)
|
||||
{
|
||||
std::cout << "bits=" << bits << " value=" << value << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (gpioInitialise() < 0) return 1;
|
||||
|
||||
Wiegand dec(14, 15, callback);
|
||||
|
||||
sleep(300);
|
||||
|
||||
dec.cancel();
|
||||
|
||||
gpioTerminate();
|
||||
}
|
||||
|
Reference in New Issue
Block a user