4 Usage: ./RFSniffer [<pulseLength>]
7 Hacked from http://code.google.com/p/rc-switch/
8 by @justy to provide a handy RF code sniffer
11 #include "../rc-switch/RCSwitch.h"
21 int main(int argc, char *argv[]) {
23 // This pin is not the first pin on the RPi GPIO header!
24 // Consult https://projects.drogon.net/raspberry-pi/wiringpi/pins/
25 // for more information.
28 if(wiringPiSetup() == -1) {
29 printf("wiringPiSetup failed, exiting...");
34 if (argv[1] != NULL) pulseLength = atoi(argv[1]);
36 mySwitch = RCSwitch();
37 if (pulseLength != 0) mySwitch.setPulseLength(pulseLength);
38 mySwitch.enableReceive(PIN); // Receiver on interrupt 0 => that is pin #2
43 if (mySwitch.available()) {
45 int value = mySwitch.getReceivedValue();
48 printf("Unknown encoding\n");
51 printf("Received %i\n", mySwitch.getReceivedValue() );
55 mySwitch.resetAvailable();