http://code.google.com/p/rc-switch/
[Arduino] / libraries / RCSwitch / examples / TypeB_WithRotaryOrSlidingSwitches / TypeB_WithRotaryOrSlidingSwitches.pde
diff --git a/libraries/RCSwitch/examples/TypeB_WithRotaryOrSlidingSwitches/TypeB_WithRotaryOrSlidingSwitches.pde b/libraries/RCSwitch/examples/TypeB_WithRotaryOrSlidingSwitches/TypeB_WithRotaryOrSlidingSwitches.pde
new file mode 100644 (file)
index 0000000..61e0d76
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+  Example for outlets which are configured with two rotary/sliding switches.
+  
+  http://code.google.com/p/rc-switch/
+*/
+
+#include <RCSwitch.h>
+
+RCSwitch mySwitch = RCSwitch();
+
+void setup() {
+
+  // Transmitter is connected to Arduino Pin #10  
+  mySwitch.enableTransmit(10);
+  
+  // Optional set pulse length.
+  // mySwitch.setPulseLength(320);
+  
+}
+
+void loop() {
+
+  // Switch on:
+  // The first parameter represents the setting of the first rotary switch. 
+  // In this example it's switched to "1" or "A" or "I". 
+  // 
+  // The second parameter represents the setting of the second rotary switch. 
+  // In this example it's switched to "4" or "D" or "IV". 
+  mySwitch.switchOn(1, 4);
+
+  // Wait a second
+  delay(1000);
+  
+  // Switch off
+  mySwitch.switchOff(1, 4);
+  
+  // Wait another second
+  delay(1000);
+  
+}