-
Notifications
You must be signed in to change notification settings - Fork 682
HowTo_OperateLowCostOutlets
Max Horn edited this page Jan 5, 2016
·
11 revisions
There are generally three common kinds of outlet switches. The first one is configured with a 10 pole DIP switch the other one is configured with two rotary (or sliding) switches with four setting possibilities each.

RCSwitch::switchOn("11001", "01000");
The first parameter represents the setting of the first 5 DIP switches. In this example it's ON-ON-OFF-OFF-ON.
The second parameter represents the setting of the last 5 DIP switches. In this example the last 5 DIP switches are OFF-ON-OFF-OFF-OFF.
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
}
void loop() {
mySwitch.switchOn("11001", "01000");
// Wait a second
delay(1000);
// Switch off
mySwitch.switchOff("11001", "01000");
// Wait another second
delay(1000);
}
RCSwitch::switchOn(4, 2);
The first parameter represents the setting of the first rotary switch. In this example it's switched to "4" or "D" or "IV".
The second parameter represents the setting of the second rotary switch. In this example it's switched to "2" or "B" or "II".
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
}
void loop() {
mySwitch.switchOn(4, 2);
// Wait a second
delay(1000);
// Switch off
mySwitch.switchOff(4, 2);
// Wait another second
delay(1000);
}RCSwitch::switchOn('a', 1, 2);