-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboiler433.ino
48 lines (40 loc) · 1.15 KB
/
boiler433.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "RCSwitch.h"
#include <stdlib.h>
#include <stdio.h>
RCSwitch mySwitch = RCSwitch();
#define RELAY1 6
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 that is pin #2
pinMode(RELAY1, OUTPUT);
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
if (value == 0) {
Serial.print("Unknown encoding");
}
else if (mySwitch.getReceivedValue() == 1234560) //put on command number here
{
Serial.print("Received ");
Serial.println( mySwitch.getReceivedValue() );
digitalWrite(RELAY1,HIGH);
}
else if (mySwitch.getReceivedValue() == 1234561) //put off command number here
{
Serial.print("Received ");
Serial.println( mySwitch.getReceivedValue() );
digitalWrite(RELAY1,LOW);
}
else {
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
}
mySwitch.resetAvailable();
}
}