Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Example for different sending methods
- https://github.com/sui77/rc-switch/
- */
- #include <RCSwitch.h>
- RCSwitch mySwitch = RCSwitch();
- void setup() {
- Serial.begin(9600);
- // Transmitter is connected to Arduino Pin #10
- mySwitch.enableTransmit(D1);
- pinMode(D4,OUTPUT);
- digitalWrite(D4,HIGH);
- // Optional set protocol (default is 1, will work for most outlets)
- // mySwitch.setProtocol(2);
- // Optional set pulse length.
- // mySwitch.setPulseLength(320);
- // Optional set number of transmission repetitions.
- // mySwitch.setRepeatTransmit(15);
- }
- void loop() {
- /* Same switch as above, but using decimal code */
- Serial.println("Nadawanie 1");
- mySwitch.send(5393, 24);
- digitalWrite(D4,LOW);
- delay(500);
- digitalWrite(D4,HIGH);
- delay(500);
- Serial.println("Nadawanie 2");
- mySwitch.send(5396, 24);
- digitalWrite(D4,LOW);
- delay(500);
- digitalWrite(D4,HIGH);
- delay(500);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement