Go to file
M Wittig 96998888bc
Merge pull request #25 from hvisser/master
Handle interrupt correctly on ESP8266
2021-06-19 18:50:35 +02:00
examples Fix compilation errors in examples 2016-05-24 21:41:44 +10:00
simulate fix for sim and pinMode 2015-03-29 22:31:42 +02:00
.gitignore Initial commit 2014-07-27 18:58:39 +02:00
LICENSE Initial commit 2014-07-27 18:58:39 +02:00
README.md Divide pulse length by 4 to handle longer pulses 2015-03-24 17:28:20 +01:00
RFControl.cpp Handle interrupt correctly on ESP8266 2019-08-18 12:04:36 +02:00
RFControl.h restructoring 2015-03-28 22:32:16 +01:00
arduino_functions.h Translate pins to interrupts on Arduino 2017-02-06 08:08:50 +03:00
library.json @PlatformIO Library Registry manifest file 2016-09-03 22:46:49 +03:00

README.md

RFControl

Arduino library for 433mhz RF sniffing and receiving.

#include <RFControl.h>

void setup() {
  Serial.begin(9600);
  RFControl::startReceiving(0);
}

void loop() {
  if(RFControl::hasData()) {
    unsigned int *timings;
    unsigned int timings_size;
    unsigned int pulse_length_divider = RFControl::getPulseLengthDivider();
    RFControl::getRaw(&timings, &timings_size);
    for(int i=0; i < timings_size; i++) {
      unsigned long timing = timings[i] * pulse_length_divider;
      Serial.print(timing);
      Serial.write('\t');
      if((i+1)%16 == 0) {
        Serial.write('\n');
      }
    }
    Serial.write('\n');
    Serial.write('\n');
    RFControl::continueReceiving();
  }
}

Outputs raw timings to serial if the same code gets received twice:

294  2630 294  242  296  1262 292  248  288  1268 286  1262 288  260  280  254  
286  1274 278  256  282  1276 280  258  276  1280 276  1272 276  270  274  1274 
274  284  276  1272 274  272  270  1278 272  272  274  262  270  1290 268  1280 
270  274  268  270  268  1288 266  270  266  1292 264  1284 264  280  266  272  
264  1302 268  272  262  1294 264  274  262  1294 262  1286 262  282  262  278  
260  1294 262  274  262  1296 262  1286 262  282  262  1286 262  282  264  274  
260  1310 260  1288 260  284  262  274  260  1298 260  276  260  1296 260  1290 
260  284  260  276  258  1300 258  278  260  1296 260  278  258  1296 260  278  
260  1292 254  10196     

It can also compress the outputs:

b: 269 2632 1286 10196 0 0 0 0 
t: 010002000202000002000200020200020002000200000202000002000202000002000200020200000200020200020000020200000200020200000200020002000203

The raw timings should be the same as outputed by pilight debug: http://wiki.pilight.org/doku.php/arctech_switch