Smart Home Automation Forum
[arduino code examples for A16v3]-10 RF433MHz sender - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A16v3 (https://www.kincony.com/forum/forumdisplay.php?fid=68)
+--- Thread: [arduino code examples for A16v3]-10 RF433MHz sender (/showthread.php?tid=7391)



[arduino code examples for A16v3]-10 RF433MHz sender - admin - 01-15-2025

Code:
/*
  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(18);
 
  // 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() {

  /* See Example: TypeA_WithDIPSwitches */
  mySwitch.switchOn("11111", "00010");
  delay(1000);
  mySwitch.switchOff("11111", "00010");
  delay(1000);

  /* Same switch as above, but using decimal code */
  mySwitch.send(5393, 24);
  delay(1000); 
  mySwitch.send(5396, 24);
  delay(1000); 

  /* Same switch as above, but using binary code */
  mySwitch.send("000000000001010100010001");
  delay(1000); 
  mySwitch.send("000000000001010100010100");
  delay(1000);

  /* Same switch as above, but tri-state code */
  mySwitch.sendTriState("00000FFF0F0F");
  delay(1000); 
  mySwitch.sendTriState("00000FFF0FF0");
  delay(1000);

  //delay(20000);
}
arduino ino file download:
.zip   10-RF433M-sender.zip (Size: 664 bytes / Downloads: 6)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   10-RF433M-sender.ino.merged.zip (Size: 181.71 KB / Downloads: 4)