Sniff 433MHz data packages using rc-switch
This commit is contained in:
parent
5072921182
commit
bc7521ac95
5 changed files with 56 additions and 11 deletions
40
source/qsniff.cpp
Normal file
40
source/qsniff.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include "rc-switch/RCSwitch.h"
|
||||
#include <wiringPi.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::cout << "qSniff" << std::endl;
|
||||
|
||||
wiringPiSetup();
|
||||
|
||||
RCSwitch mySwitch = RCSwitch();
|
||||
|
||||
mySwitch.enableReceive(6);
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (mySwitch.available())
|
||||
{
|
||||
int value = mySwitch.getReceivedValue();
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
std::cout << "Unknown encoding" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Received " << value << " / ";
|
||||
std::cout << mySwitch.getReceivedBitlength() << " bit ";
|
||||
std::cout << "Protocol: " << mySwitch.getReceivedProtocol();
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
mySwitch.resetAvailable();
|
||||
}
|
||||
|
||||
delay(100);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue