pigpio/EXAMPLES/CPP/IR_RECEIVER/test_ir_hasher.cpp

45 lines
637 B
C++
Raw Normal View History

2014-11-25 17:36:44 +01:00
#include <iostream>
#include <pigpio.h>
#include "ir_hasher.hpp"
/*
REQUIRES
An IR receiver output pin connected to a Pi gpio.
TO BUILD
2015-02-25 21:34:52 +01:00
g++ -o ir_hash_cpp test_ir_hasher.cpp ir_hasher.cpp -lpigpio -lrt -lpthread
2014-11-25 17:36:44 +01:00
TO RUN
sudo ./ir_hash_cpp
*/
void callback(uint32_t hash)
{
std::cout << "hash=" << hash << std::endl;
}
int main(int argc, char *argv[])
{
if (gpioInitialise() >= 0)
{
/* Can't instantiate a Hasher before pigpio is initialised. */
/*
This assumes the output pin of an IR receiver is
connected to gpio 7.
*/
Hasher ir(7, callback);
sleep(300);
}
}