Advertisement
pan7nikt

Send433

Mar 14th, 2023
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. /*
  2.   Example for different sending methods
  3.  
  4.   https://github.com/sui77/rc-switch/
  5.  
  6. */
  7.  
  8. #include <RCSwitch.h>
  9.  
  10. RCSwitch mySwitch = RCSwitch();
  11.  
  12. void setup() {
  13.  
  14.   Serial.begin(9600);
  15.  
  16.   // Transmitter is connected to Arduino Pin #10  
  17.   mySwitch.enableTransmit(D1);
  18.   pinMode(D4,OUTPUT);
  19.   digitalWrite(D4,HIGH);
  20.  
  21.   // Optional set protocol (default is 1, will work for most outlets)
  22.   // mySwitch.setProtocol(2);
  23.  
  24.   // Optional set pulse length.
  25.   // mySwitch.setPulseLength(320);
  26.  
  27.   // Optional set number of transmission repetitions.
  28.   // mySwitch.setRepeatTransmit(15);
  29.  
  30. }
  31.  
  32. void loop() {
  33.   /* Same switch as above, but using decimal code */
  34.   Serial.println("Nadawanie 1");
  35.   mySwitch.send(5393, 24);
  36.   digitalWrite(D4,LOW);
  37.   delay(500);  
  38.   digitalWrite(D4,HIGH);
  39.   delay(500);  
  40.   Serial.println("Nadawanie 2");
  41.   mySwitch.send(5396, 24);
  42.   digitalWrite(D4,LOW);
  43.   delay(500);  
  44.   digitalWrite(D4,HIGH);
  45.   delay(500);  
  46.   delay(1000);  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement