libraries / rc-switch-2.52 / examples / SendDemo / SendDemo.pdeon commit Added link to project report (97a3ba0)
   1/*
   2  Example for different sending methods
   3  
   4  http://code.google.com/p/rc-switch/
   5  
   6*/
   7
   8#include <RCSwitch.h>
   9
  10RCSwitch mySwitch = RCSwitch();
  11
  12void setup() {
  13
  14  Serial.begin(9600);
  15  
  16  // Transmitter is connected to Arduino Pin #10  
  17  mySwitch.enableTransmit(10);
  18
  19  // Optional set pulse length.
  20  // mySwitch.setPulseLength(320);
  21  
  22  // Optional set protocol (default is 1, will work for most outlets)
  23  // mySwitch.setProtocol(2);
  24  
  25  // Optional set number of transmission repetitions.
  26  // mySwitch.setRepeatTransmit(15);
  27  
  28}
  29
  30void loop() {
  31
  32  /* See Example: TypeA_WithDIPSwitches */
  33  mySwitch.switchOn("11111", "00010");
  34  delay(1000);
  35  mySwitch.switchOn("11111", "00010");
  36  delay(1000);
  37
  38  /* Same switch as above, but using decimal code */
  39  mySwitch.send(5393, 24);
  40  delay(1000);  
  41  mySwitch.send(5396, 24);
  42  delay(1000);  
  43
  44  /* Same switch as above, but using binary code */
  45  mySwitch.send("000000000001010100010001");
  46  delay(1000);  
  47  mySwitch.send("000000000001010100010100");
  48  delay(1000);
  49
  50  /* Same switch as above, but tri-state code */ 
  51  mySwitch.sendTriState("00000FFF0F0F");
  52  delay(1000);  
  53  mySwitch.sendTriState("00000FFF0FF0");
  54  delay(1000);
  55
  56  delay(20000);
  57}