test_ir_hasher.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 
00003 #include <pigpio.h>
00004 
00005 #include "ir_hasher.h"
00006 
00007 /*
00008 
00009 REQUIRES
00010 
00011 An IR receiver output pin connected to a Pi gpio.
00012 
00013 TO BUILD
00014 
00015 gcc -o ir_hash_c test_ir_hasher.c  ir_hasher.c -lpigpio -lrt -lpthread
00016 
00017 TO RUN
00018 
00019 sudo ./ir_hash_c
00020 
00021 */
00022 
00023 void callback(uint32_t hash)
00024 {
00025    printf("hash=%u\n", hash);
00026 }
00027 
00028 int main(int argc, char *argv[])
00029 {
00030    Pi_Hasher_t *hasher;
00031 
00032    if (gpioInitialise() < 0) return 1;
00033 
00034    /* 
00035       This assumes the output pin of an IR receiver is
00036       connected to gpio 7.
00037    */
00038 
00039    hasher = Pi_Hasher(7, callback, 5);
00040 
00041    sleep(300);
00042 
00043    Pi_Hasher_cancel(hasher);
00044 
00045    gpioTerminate();
00046 }
00047 


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Thu Jun 6 2019 20:43:57