test_ir_hasher.cpp
Go to the documentation of this file.
1 #include <iostream>
2 
3 #include <pigpio.h>
4 
5 #include "ir_hasher.hpp"
6 
7 /*
8 
9 REQUIRES
10 
11 An IR receiver output pin connected to a Pi gpio.
12 
13 TO BUILD
14 
15 g++ -o ir_hash_cpp test_ir_hasher.cpp ir_hasher.cpp -lpigpio -lrt -lpthread
16 
17 TO RUN
18 
19 sudo ./ir_hash_cpp
20 
21 */
22 
23 void callback(uint32_t hash)
24 {
25  std::cout << "hash=" << hash << std::endl;
26 }
27 
28 int main(int argc, char *argv[])
29 {
30  if (gpioInitialise() >= 0)
31  {
32  /* Can't instantiate a Hasher before pigpio is initialised. */
33 
34  /*
35  This assumes the output pin of an IR receiver is
36  connected to gpio 7.
37  */
38 
39  Hasher ir(7, callback);
40 
41  sleep(300);
42  }
43 }
44 
int gpioInitialise(void)
Definition: pigpio.c:8459
int main(int argc, char *argv[])
void callback(uint32_t hash)


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