Skip to content

Commit

Permalink
Merge pull request ninjablocks#11 from rotv/master
Browse files Browse the repository at this point in the history
Added optional pulse-length argument to RFSniffer and the executables to gitignore
  • Loading branch information
☃ Elliot Shepherd committed Jan 7, 2016
2 parents 2e2ebc6 + c604a00 commit 9b75288
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@
*.lai
*.la
*.a

# Compiled executables
RPi_utils/RFSniffer
RPi_utils/codesend
RPi_utils/send

18 changes: 13 additions & 5 deletions RPi_utils/RFSniffer.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/*
RF_Sniffer
RFSniffer
Usage: ./RFSniffer [<pulseLength>]
[] = optional
Hacked from http://code.google.com/p/rc-switch/
by @justy to provide a handy RF code sniffer
*/

Expand All @@ -22,11 +24,17 @@ int main(int argc, char *argv[]) {
// for more information.
int PIN = 2;

if(wiringPiSetup() == -1)
if(wiringPiSetup() == -1) {
printf("wiringPiSetup failed, exiting...");
return 0;
}

int pulseLength = 0;
if (argv[1] != NULL) pulseLength = atoi(argv[1]);

mySwitch = RCSwitch();
mySwitch.enableReceive(PIN); // Receiver on inerrupt 0 => that is pin #2
if (pulseLength != 0) mySwitch.setPulseLength(pulseLength);
mySwitch.enableReceive(PIN); // Receiver on interrupt 0 => that is pin #2


while(1) {
Expand Down

0 comments on commit 9b75288

Please sign in to comment.