Advertisement
JetSerge

SendDemo.pde

Jun 13th, 2014
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. /*
  2.   Example for different sending methods
  3.  
  4.   http://code.google.com/p/rc-switch/
  5.  
  6. */
  7.  
  8. #include <RCSwitch.h>
  9.  
  10. RCSwitch mySwitch = RCSwitch();
  11.  
  12. void setup() {
  13.   Serial.begin(9600);
  14.  
  15.   // Transmitter is connected to Arduino Pin #10  
  16.   mySwitch.enableTransmit(10);
  17.   // Optional set pulse length.
  18.   // mySwitch.setPulseLength(320);
  19.  
  20.   // Optional set protocol (default is 1, will work for most outlets)
  21.   // mySwitch.setProtocol(2);
  22.  
  23.   // Optional set number of transmission repetitions.
  24.   mySwitch.setRepeatTransmit(10);
  25. }
  26.  
  27. void loop() {
  28.   Serial.println("off");
  29.   mySwitch.send(20, 24);
  30.   delay(2000);
  31.   Serial.println("on");
  32.   mySwitch.send(21, 24);
  33.   delay(2000);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement