Skip to content

Instantly share code, notes, and snippets.

@IOT-123
Created January 20, 2018 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IOT-123/85b24c618a10eb19773a7727f54c460d to your computer and use it in GitHub Desktop.
Save IOT-123/85b24c618a10eb19773a7727f54c460d to your computer and use it in GitHub Desktop.
One of https://github.com/sui77/rc-switch/ demos with pins included for D1M RFTXRX BLOCK.
/*
Example for different sending methods
https://github.com/sui77/rc-switch/
modified fo D1M RFTXRX BLOCK pins
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(D0); // D0 or D5 or D6 or D7 or D8
}
void loop() {
/* See Example: TypeA_WithDIPSwitches */
mySwitch.switchOn("11111", "00010");
delay(1000);
mySwitch.switchOff("11111", "00010");
delay(1000);
/* Same switch as above, but using decimal code */
mySwitch.send(5393, 24);
delay(1000);
mySwitch.send(5396, 24);
delay(1000);
/* Same switch as above, but using binary code */
mySwitch.send("000000000001010100010001");
delay(1000);
mySwitch.send("000000000001010100010100");
delay(1000);
/* Same switch as above, but tri-state code */
mySwitch.sendTriState("00000FFF0F0F");
delay(1000);
mySwitch.sendTriState("00000FFF0FF0");
delay(1000);
delay(20000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment