4 Created by Dmitry Shalnov (c) 2019 for Interplay Mediumâ„¢ project.
6 Based on RFSniffer.cpp http://code.google.com/p/rc-switch/ by @justy
10 #include "../rc-switch/RCSwitch.h"
19 printf("433mHz module reader. Created by Dmitry Shalnoff [interplaymedium.org] © 2019, Ver 0.0.2.\n");
21 printf(" -l pulse length (optional)\n");
22 printf(" -p GPIO pin\n");
27 int main(int argc, char *argv[]) {
30 int PIN = 0; // default
36 if ( argCnt > 2 && argv[1][0] == '-' && argv[ argCnt - 1 ][0] != '-' ){
42 if ( argv[ argCnt ][0] == '-' && argv[ argCnt + 1 ][0] != '-' ) {
44 switch (argv[ argCnt ][1])
47 pulseLength = atoi( argv[ argCnt + 1 ] );
48 printf("Pulse length: %d\n",pulseLength);
52 PIN = atoi( argv[ argCnt + 1 ] );
53 printf("GPIO: %d\n", PIN);;
57 printf("Wrong Argument: %s\n", argv[ argCnt ]);
68 // ---------------------
70 if(wiringPiSetup() == -1) {
71 printf("wiringPiSetup failed, exiting...");
76 mySwitch = RCSwitch();
77 if (pulseLength != 0) mySwitch.setPulseLength(pulseLength);
78 mySwitch.enableReceive( PIN );
83 mySwitch.handleNoInterrupt( PIN ); // polling handler, nanoPi WiringNP (no interrupts supported)
86 if (mySwitch.available()) {
88 int value = mySwitch.getReceivedValue();
91 printf("Unknown encoding\n");
93 printf("Received %i\n", mySwitch.getReceivedValue() );
97 mySwitch.resetAvailable();