-
Notifications
You must be signed in to change notification settings - Fork 662
HowTo_Send
Max Horn edited this page Jan 5, 2016
·
4 revisions
If you intend to only operate some power sockets you should take a look at this HowTo.
(You can also use any other I/O Pin of your Arduino instead of Pin #10)
There are three methods to send raw codes:
send(string binaryCode)
Sends the binary string.
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
mySwitch.enableTransmit(10); // Using Pin #10
}
void loop() {
mySwitch.send("000000000001010100010001");
delay(1000);
}
send(int decimalCode, int bitLength)
Same as the first one but using the decimal value. The bit length is needed to zero-fill the binary code.
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
mySwitch.enableTransmit(10); // Using Pin #10
}
void loop() {
mySwitch.send(5393, 24);
delay(1000);
}
sendTriState(string triStateCode)
Tri-state codes are according to the data sheets of some encoding chips. Take a look at this blogpost if you are interested in details.
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
mySwitch.enableTransmit(10); // Using Pin #10
}
void loop() {
mySwitch.sendTriState("00000FFF0F0F");
delay(1000);
}