Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Simple example for receiving
- http://code.google.com/p/rc-switch/
- Need help? http://forum.ardumote.com
- */
- #include <RCSwitch.h>
- RCSwitch mySwitch = RCSwitch();
- void setup() {
- Serial.begin(9600);
- mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
- }
- void loop() {
- if (mySwitch.available()) {
- int value = mySwitch.getReceivedValue();
- if (value == 0) {
- Serial.print("Unknown encoding");
- } else {
- Serial.print("Received ");
- Serial.print( mySwitch.getReceivedValue() );
- Serial.print(" / ");
- Serial.print( mySwitch.getReceivedBitlength() );
- Serial.print("bit ");
- Serial.print("Protocol: ");
- Serial.println( mySwitch.getReceivedProtocol() );
- Serial.print("Received RAW Data: ");
- Serial.println((int) mySwitch.getReceivedRawdata());
- }
- mySwitch.resetAvailable();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement