<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Smart Home Automation Forum - TA]]></title>
		<link>https://www.kincony.com/forum/</link>
		<description><![CDATA[Smart Home Automation Forum - https://www.kincony.com/forum]]></description>
		<pubDate>Sat, 04 Jul 2026 18:23:57 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Tiny Alarm board after flashing seems to no longer working]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=9477</link>
			<pubDate>Fri, 12 Jun 2026 21:29:03 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=11007">algaema</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=9477</guid>
			<description><![CDATA[Hi Kincony,<br />
<br />
I have tried to flash newer version firmware (tried KCS_KC_TA_V3.25.0.zip) from a Mac. Tried multiple methods, including the use of a Windows VM with the official tool, and web.esphome.io. But while both tool reported success, when I turn off and on the board it is not able to respond on network. I have even tried to use the method of removing power, pressing the DW button, and then attaching the power, and then used the official tool to copy firmware using a low (115200) baud rate, while the tool has reported success, after reset the board it is just not responding on network (I can verify that on the switch statistics, in which the "bytes sent" in switch has high values, however "bytes received" in switch is always showing 0, indicating that the Tiny Alarm board is not responding any packet at all. <br />
<br />
I have also tested to use USB C to USB A cable instead of a USB C to USB C cable as I see the youtube video is using one of that. <br />
<br />
May I ask how is there a way to troubleshoot a ESP32S3 board boot up message to see if the firmware is correctly copied?]]></description>
			<content:encoded><![CDATA[Hi Kincony,<br />
<br />
I have tried to flash newer version firmware (tried KCS_KC_TA_V3.25.0.zip) from a Mac. Tried multiple methods, including the use of a Windows VM with the official tool, and web.esphome.io. But while both tool reported success, when I turn off and on the board it is not able to respond on network. I have even tried to use the method of removing power, pressing the DW button, and then attaching the power, and then used the official tool to copy firmware using a low (115200) baud rate, while the tool has reported success, after reset the board it is just not responding on network (I can verify that on the switch statistics, in which the "bytes sent" in switch has high values, however "bytes received" in switch is always showing 0, indicating that the Tiny Alarm board is not responding any packet at all. <br />
<br />
I have also tested to use USB C to USB A cable instead of a USB C to USB C cable as I see the youtube video is using one of that. <br />
<br />
May I ask how is there a way to troubleshoot a ESP32S3 board boot up message to see if the firmware is correctly copied?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[New TA web interface unavailable]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=9208</link>
			<pubDate>Fri, 03 Apr 2026 21:55:23 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=10682">pbouwen</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=9208</guid>
			<description><![CDATA[Hi everyone,<br />
<br />
Just received my first Kincony device; a Tiny Alarm system.<br />
<br />
Unfortunately, I don't succeed in accessing the web interface to set it up for use with Home Assistant.<br />
I powered it with PoE and looked up the assigned IP address in my router.<br />
When I try accessing that IP in my browser, I get the message that the page can't be reached.<br />
I can ping the IP however.<br />
<br />
Rebooting the device did not help.<br />
Holding the reset button for +10 seconds also did not change anything.<br />
<br />
What other steps can I take to troubleshoot this?<br />
Should I try to reflash it? I'm using a Mac so not my preferred option.<br />
<br />
Thanks in advance for your help!]]></description>
			<content:encoded><![CDATA[Hi everyone,<br />
<br />
Just received my first Kincony device; a Tiny Alarm system.<br />
<br />
Unfortunately, I don't succeed in accessing the web interface to set it up for use with Home Assistant.<br />
I powered it with PoE and looked up the assigned IP address in my router.<br />
When I try accessing that IP in my browser, I get the message that the page can't be reached.<br />
I can ping the IP however.<br />
<br />
Rebooting the device did not help.<br />
Holding the reset button for +10 seconds also did not change anything.<br />
<br />
What other steps can I take to troubleshoot this?<br />
Should I try to reflash it? I'm using a Mac so not my preferred option.<br />
<br />
Thanks in advance for your help!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[linux command line / bash scripting]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8899</link>
			<pubDate>Sun, 11 Jan 2026 14:49:40 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=10204">almman</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8899</guid>
			<description><![CDATA[Hello,<br />
<br />
I currently use AD2USB to communicate with my Honeywell Vista alarm system. Together with ser2sock (serial to socket), in bash/Linux, I use:<br />
<br />
if exec 3&lt;/dev/tcp/localhost/444555 ; then<br />
  cat &lt;&amp;3 | while read -t12 msg ; do<br />
        # Print last keypad/console message.<br />
        # Example: ****DISARMED****  Ready to Arm<br />
        echo "&#36;msg"<br />
        sleep 1<br />
  done<br />
fi<br />
<br />
There are also functions to send commands to the alarm as if it were typed on the keypad.<br />
<br />
How does one send/receive to/from the TA ESP32-S3 via command line/bash scripts?<br />
<br />
Thanks]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
I currently use AD2USB to communicate with my Honeywell Vista alarm system. Together with ser2sock (serial to socket), in bash/Linux, I use:<br />
<br />
if exec 3&lt;/dev/tcp/localhost/444555 ; then<br />
  cat &lt;&amp;3 | while read -t12 msg ; do<br />
        # Print last keypad/console message.<br />
        # Example: ****DISARMED****  Ready to Arm<br />
        echo "&#36;msg"<br />
        sleep 1<br />
  done<br />
fi<br />
<br />
There are also functions to send commands to the alarm as if it were typed on the keypad.<br />
<br />
How does one send/receive to/from the TA ESP32-S3 via command line/bash scripts?<br />
<br />
Thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA["SmartLife" wifi transmit]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8868</link>
			<pubDate>Sat, 03 Jan 2026 03:03:46 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=10152">hinterland</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8868</guid>
			<description><![CDATA[My tiny alarm seems to be transmitting a wifi signal (AP?)  "SmartLife-C886" how do i disable that?]]></description>
			<content:encoded><![CDATA[My tiny alarm seems to be transmitting a wifi signal (AP?)  "SmartLife-C886" how do i disable that?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[TA details about RTC and RF]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8762</link>
			<pubDate>Sun, 23 Nov 2025 23:40:02 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=9315">5310h</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8762</guid>
			<description><![CDATA[Hi. I am working on code for TA and have the following questions:<br />
<br />
What RTC is used?<br />
<br />
What is the RF Receiver type?<br />
<br />
Thanks]]></description>
			<content:encoded><![CDATA[Hi. I am working on code for TA and have the following questions:<br />
<br />
What RTC is used?<br />
<br />
What is the RF Receiver type?<br />
<br />
Thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[TA needs fallback cellular for monitoring service]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8455</link>
			<pubDate>Tue, 19 Aug 2025 08:33:35 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=9315">5310h</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8455</guid>
			<description><![CDATA[Hi<br />
In order to make the TA a complete security alarm system, it needs a method to communicate to a monitoring service when the Wifi / Internet is down.  Since Kincony already has the SIM7600e board that is used on other products, I would like to see it added to the TA ASAP.  Without it, the TA is just like all the other DIY products.  Really, it's the missing piece.]]></description>
			<content:encoded><![CDATA[Hi<br />
In order to make the TA a complete security alarm system, it needs a method to communicate to a monitoring service when the Wifi / Internet is down.  Since Kincony already has the SIM7600e board that is used on other products, I would like to see it added to the TA ASAP.  Without it, the TA is just like all the other DIY products.  Really, it's the missing piece.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Temp sensor]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8121</link>
			<pubDate>Fri, 30 May 2025 05:25:58 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=6729">williemcvillage</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8121</guid>
			<description><![CDATA[Hi<br />
<br />
Can I use temp sensor DS18B20 or temp/humidity DHT11 with this board?<br />
<br />
In case they're not compatible, which ones should work? <br />
<br />
How should be the wiring?<br />
<br />
Thanks]]></description>
			<content:encoded><![CDATA[Hi<br />
<br />
Can I use temp sensor DS18B20 or temp/humidity DHT11 with this board?<br />
<br />
In case they're not compatible, which ones should work? <br />
<br />
How should be the wiring?<br />
<br />
Thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[More inputs please]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8006</link>
			<pubDate>Sun, 20 Apr 2025 19:56:54 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1480">kbo</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8006</guid>
			<description><![CDATA[Hi,<br />
<br />
I need more inputs for my alarm central. 32 inputs should be enough.<br />
Is there a larger (more inputs) version  planned ?<br />
<br />
Greetings,<br />
Kris B.]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
I need more inputs for my alarm central. 32 inputs should be enough.<br />
Is there a larger (more inputs) version  planned ?<br />
<br />
Greetings,<br />
Kris B.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for TA]-08 how to communication with Tuya WiFi module]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7905</link>
			<pubDate>Thu, 03 Apr 2025 14:55:44 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7905</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 * <br />
 * This Arduino program implements communication between ESP32 and the Tuya module<br />
 * via UART (serial communication). It listens for specific packets from the Tuya module<br />
 * and responds according to the predefined commands.<br />
 * <br />
 * Functionality:<br />
 * 1. When the ESP32 receives a heartbeat packet (55 AA 00 00 00 00 FF),<br />
 *    it sends a heartbeat response (55 AA 03 00 00 01 00 03).<br />
 * 2. When the ESP32 receives a product information request (55 AA 00 01 00 00 00),<br />
 *    it sends a product information response (55 AA 03 01 ...).<br />
 * 3. When the ESP32 receives a work mode request (55 AA 00 02 00 00 01),<br />
 *    it sends a work mode response (55 AA 03 02 00 03 10 1C 14 47).<br />
 * 4. When the ESP32 receives a network status request (55 AA 00 03 00 01 00 03),<br />
 *    it sends a network status response (55 AA 03 03 00 00 05).<br />
 * 5. Subsequent heartbeat packets (55 AA 00 00 00 00 FF) are responded to with<br />
 *    (55 AA 03 00 00 01 01 04).<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Create a HardwareSerial object for UART communication on ESP32<br />
HardwareSerial tuyaSerial(1);<br />
<br />
// Define the GPIO pins for TXD and RXD used for serial communication<br />
#define TXD_PIN 16<br />
#define RXD_PIN 17<br />
<br />
// Set the baud rate for Tuya module communication to 9600<br />
#define BAUD_RATE 9600<br />
<br />
// Define the response packets for different commands from the Tuya module<br />
<br />
// Heartbeat response: 55 AA 03 00 00 01 00 03<br />
uint8_t heartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x00, 0x03};<br />
<br />
// Product info response with a detailed payload (e.g., firmware version, product name, etc.)<br />
uint8_t productInfoResponse[] = {<br />
  0x55, 0xAA, 0x03, 0x01, 0x00, 0x2A, 0x7B, 0x22, 0x70, 0x22, 0x3A, 0x22, <br />
  0x63, 0x68, 0x6D, 0x7A, 0x6C, 0x67, 0x6A, 0x70, 0x61, 0x64, 0x70, 0x71, <br />
  0x78, 0x64, 0x6B, 0x6F, 0x22, 0x2C, 0x22, 0x76, 0x22, 0x3A, 0x22, 0x31, <br />
  0x2E, 0x30, 0x2E, 0x30, 0x22, 0x2C, 0x22, 0x6D, 0x22, 0x3A, 0x30, 0x7D, 0xAA<br />
};<br />
<br />
// Work mode response: 55 AA 03 02 00 03 10 1C 14 47<br />
uint8_t workModeResponse[] = {0x55, 0xAA, 0x03, 0x02, 0x00, 0x03, 0x10, 0x1C, 0x14, 0x47};<br />
<br />
// Network status response: 55 AA 03 03 00 00 05<br />
uint8_t netStatusResponse[] = {0x55, 0xAA, 0x03, 0x03, 0x00, 0x00, 0x05};<br />
<br />
// Subsequent heartbeat response: 55 AA 03 00 00 01 01 04<br />
uint8_t secondHeartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x01, 0x04};<br />
<br />
void setup() {<br />
  // Initialize the serial communication for debugging at 115200 baud rate<br />
  Serial.begin(115200);<br />
<br />
  // Initialize the serial communication with Tuya module at 9600 baud rate<br />
  tuyaSerial.begin(BAUD_RATE, SERIAL_8N1, RXD_PIN, TXD_PIN);<br />
<br />
  // Debug message to indicate that the serial communication has been initialized<br />
  Serial.println("ESP32-Tuya serial communication initialized.");<br />
}<br />
<br />
void loop() {<br />
  // Check if data is available from the Tuya module<br />
  if (tuyaSerial.available()) {<br />
    uint8_t incomingPacket[7];  // Array to store the received packet<br />
    size_t bytesRead = tuyaSerial.readBytes(incomingPacket, 7); // Read 7 bytes from Tuya<br />
<br />
    // Check if the packet has a valid header (0x55, 0xAA)<br />
    if (bytesRead &gt;= 2 &amp;&amp; incomingPacket[0] == 0x55 &amp;&amp; incomingPacket[1] == 0xAA) {<br />
      // If less than 7 bytes were received, wait for more data<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Incomplete packet received. Waiting for remaining bytes...");<br />
        delay(50); // Delay to allow more data to be received<br />
        while (tuyaSerial.available()) {<br />
          incomingPacket[bytesRead++] = tuyaSerial.read(); // Continue reading remaining bytes<br />
          if (bytesRead &gt;= 7) break;<br />
        }<br />
      }<br />
<br />
      // If still less than 7 bytes, discard the incomplete packet<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Error: Incomplete packet discarded.");<br />
        return;<br />
      }<br />
<br />
      // Debug: Print the received packet for logging<br />
      Serial.print("Received packet: ");<br />
      for (size_t i = 0; i &lt; 7; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
<br />
      // Call the function to process the received packet<br />
      processTuyaPacket(incomingPacket, 7);<br />
<br />
    } else {<br />
      // If the header is invalid, discard the packet and flush the buffer<br />
      Serial.print("Error: Invalid packet header. Data received: ");<br />
      for (size_t i = 0; i &lt; bytesRead; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
      tuyaSerial.flush(); // Clear the serial buffer<br />
    }<br />
  }<br />
<br />
  // Delay to avoid CPU overuse<br />
  delay(100);<br />
}<br />
<br />
// Function to process the received packet and send the appropriate response<br />
void processTuyaPacket(uint8_t* packet, size_t size) {<br />
  // Ensure the packet size is 7 and the header is valid<br />
  if (size == 7 &amp;&amp; packet[0] == 0x55 &amp;&amp; packet[1] == 0xAA) {<br />
    // Determine the command in the packet (packet[2])<br />
    switch(packet[2]) {<br />
      case 0x00:<br />
        if (packet[3] == 0x00 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0xFF) {<br />
          Serial.println("Heartbeat received.");<br />
          sendPacket(heartBeatResponse, sizeof(heartBeatResponse));<br />
        } else if (packet[3] == 0x01 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Product info request received.");<br />
          sendPacket(productInfoResponse, sizeof(productInfoResponse));<br />
        } else if (packet[3] == 0x02 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x01) {<br />
          Serial.println("Work mode request received.");<br />
          sendPacket(workModeResponse, sizeof(workModeResponse));<br />
        } else if (packet[3] == 0x03 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x01 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Network status request received.");<br />
          sendPacket(netStatusResponse, sizeof(netStatusResponse));<br />
        }<br />
        break;<br />
<br />
      default:<br />
        Serial.println("Error: Unhandled command received.");<br />
        break;<br />
    }<br />
  }<br />
}<br />
<br />
// Function to send the response packet to the Tuya module<br />
void sendPacket(uint8_t* packet, size_t size) {<br />
  // Send the packet via UART to Tuya module<br />
  tuyaSerial.write(packet, size);<br />
<br />
  // Debug: Print the sent packet for logging<br />
  Serial.print("Sent packet: ");<br />
  for (size_t i = 0; i &lt; size; i++) {<br />
    Serial.print(packet[i], HEX);<br />
    Serial.print(" ");<br />
  }<br />
  Serial.println();<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7366" target="_blank" title="">8-tuya-wifi-config.zip</a> (Size: 2 KB / Downloads: 550)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7367" target="_blank" title="">8-tuya-wifi-config.ino.merged.zip</a> (Size: 187.17 KB / Downloads: 569)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 * <br />
 * This Arduino program implements communication between ESP32 and the Tuya module<br />
 * via UART (serial communication). It listens for specific packets from the Tuya module<br />
 * and responds according to the predefined commands.<br />
 * <br />
 * Functionality:<br />
 * 1. When the ESP32 receives a heartbeat packet (55 AA 00 00 00 00 FF),<br />
 *    it sends a heartbeat response (55 AA 03 00 00 01 00 03).<br />
 * 2. When the ESP32 receives a product information request (55 AA 00 01 00 00 00),<br />
 *    it sends a product information response (55 AA 03 01 ...).<br />
 * 3. When the ESP32 receives a work mode request (55 AA 00 02 00 00 01),<br />
 *    it sends a work mode response (55 AA 03 02 00 03 10 1C 14 47).<br />
 * 4. When the ESP32 receives a network status request (55 AA 00 03 00 01 00 03),<br />
 *    it sends a network status response (55 AA 03 03 00 00 05).<br />
 * 5. Subsequent heartbeat packets (55 AA 00 00 00 00 FF) are responded to with<br />
 *    (55 AA 03 00 00 01 01 04).<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Create a HardwareSerial object for UART communication on ESP32<br />
HardwareSerial tuyaSerial(1);<br />
<br />
// Define the GPIO pins for TXD and RXD used for serial communication<br />
#define TXD_PIN 16<br />
#define RXD_PIN 17<br />
<br />
// Set the baud rate for Tuya module communication to 9600<br />
#define BAUD_RATE 9600<br />
<br />
// Define the response packets for different commands from the Tuya module<br />
<br />
// Heartbeat response: 55 AA 03 00 00 01 00 03<br />
uint8_t heartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x00, 0x03};<br />
<br />
// Product info response with a detailed payload (e.g., firmware version, product name, etc.)<br />
uint8_t productInfoResponse[] = {<br />
  0x55, 0xAA, 0x03, 0x01, 0x00, 0x2A, 0x7B, 0x22, 0x70, 0x22, 0x3A, 0x22, <br />
  0x63, 0x68, 0x6D, 0x7A, 0x6C, 0x67, 0x6A, 0x70, 0x61, 0x64, 0x70, 0x71, <br />
  0x78, 0x64, 0x6B, 0x6F, 0x22, 0x2C, 0x22, 0x76, 0x22, 0x3A, 0x22, 0x31, <br />
  0x2E, 0x30, 0x2E, 0x30, 0x22, 0x2C, 0x22, 0x6D, 0x22, 0x3A, 0x30, 0x7D, 0xAA<br />
};<br />
<br />
// Work mode response: 55 AA 03 02 00 03 10 1C 14 47<br />
uint8_t workModeResponse[] = {0x55, 0xAA, 0x03, 0x02, 0x00, 0x03, 0x10, 0x1C, 0x14, 0x47};<br />
<br />
// Network status response: 55 AA 03 03 00 00 05<br />
uint8_t netStatusResponse[] = {0x55, 0xAA, 0x03, 0x03, 0x00, 0x00, 0x05};<br />
<br />
// Subsequent heartbeat response: 55 AA 03 00 00 01 01 04<br />
uint8_t secondHeartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x01, 0x04};<br />
<br />
void setup() {<br />
  // Initialize the serial communication for debugging at 115200 baud rate<br />
  Serial.begin(115200);<br />
<br />
  // Initialize the serial communication with Tuya module at 9600 baud rate<br />
  tuyaSerial.begin(BAUD_RATE, SERIAL_8N1, RXD_PIN, TXD_PIN);<br />
<br />
  // Debug message to indicate that the serial communication has been initialized<br />
  Serial.println("ESP32-Tuya serial communication initialized.");<br />
}<br />
<br />
void loop() {<br />
  // Check if data is available from the Tuya module<br />
  if (tuyaSerial.available()) {<br />
    uint8_t incomingPacket[7];  // Array to store the received packet<br />
    size_t bytesRead = tuyaSerial.readBytes(incomingPacket, 7); // Read 7 bytes from Tuya<br />
<br />
    // Check if the packet has a valid header (0x55, 0xAA)<br />
    if (bytesRead &gt;= 2 &amp;&amp; incomingPacket[0] == 0x55 &amp;&amp; incomingPacket[1] == 0xAA) {<br />
      // If less than 7 bytes were received, wait for more data<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Incomplete packet received. Waiting for remaining bytes...");<br />
        delay(50); // Delay to allow more data to be received<br />
        while (tuyaSerial.available()) {<br />
          incomingPacket[bytesRead++] = tuyaSerial.read(); // Continue reading remaining bytes<br />
          if (bytesRead &gt;= 7) break;<br />
        }<br />
      }<br />
<br />
      // If still less than 7 bytes, discard the incomplete packet<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Error: Incomplete packet discarded.");<br />
        return;<br />
      }<br />
<br />
      // Debug: Print the received packet for logging<br />
      Serial.print("Received packet: ");<br />
      for (size_t i = 0; i &lt; 7; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
<br />
      // Call the function to process the received packet<br />
      processTuyaPacket(incomingPacket, 7);<br />
<br />
    } else {<br />
      // If the header is invalid, discard the packet and flush the buffer<br />
      Serial.print("Error: Invalid packet header. Data received: ");<br />
      for (size_t i = 0; i &lt; bytesRead; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
      tuyaSerial.flush(); // Clear the serial buffer<br />
    }<br />
  }<br />
<br />
  // Delay to avoid CPU overuse<br />
  delay(100);<br />
}<br />
<br />
// Function to process the received packet and send the appropriate response<br />
void processTuyaPacket(uint8_t* packet, size_t size) {<br />
  // Ensure the packet size is 7 and the header is valid<br />
  if (size == 7 &amp;&amp; packet[0] == 0x55 &amp;&amp; packet[1] == 0xAA) {<br />
    // Determine the command in the packet (packet[2])<br />
    switch(packet[2]) {<br />
      case 0x00:<br />
        if (packet[3] == 0x00 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0xFF) {<br />
          Serial.println("Heartbeat received.");<br />
          sendPacket(heartBeatResponse, sizeof(heartBeatResponse));<br />
        } else if (packet[3] == 0x01 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Product info request received.");<br />
          sendPacket(productInfoResponse, sizeof(productInfoResponse));<br />
        } else if (packet[3] == 0x02 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x01) {<br />
          Serial.println("Work mode request received.");<br />
          sendPacket(workModeResponse, sizeof(workModeResponse));<br />
        } else if (packet[3] == 0x03 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x01 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Network status request received.");<br />
          sendPacket(netStatusResponse, sizeof(netStatusResponse));<br />
        }<br />
        break;<br />
<br />
      default:<br />
        Serial.println("Error: Unhandled command received.");<br />
        break;<br />
    }<br />
  }<br />
}<br />
<br />
// Function to send the response packet to the Tuya module<br />
void sendPacket(uint8_t* packet, size_t size) {<br />
  // Send the packet via UART to Tuya module<br />
  tuyaSerial.write(packet, size);<br />
<br />
  // Debug: Print the sent packet for logging<br />
  Serial.print("Sent packet: ");<br />
  for (size_t i = 0; i &lt; size; i++) {<br />
    Serial.print(packet[i], HEX);<br />
    Serial.print(" ");<br />
  }<br />
  Serial.println();<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7366" target="_blank" title="">8-tuya-wifi-config.zip</a> (Size: 2 KB / Downloads: 550)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7367" target="_blank" title="">8-tuya-wifi-config.ino.merged.zip</a> (Size: 187.17 KB / Downloads: 569)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for TA]-07 Ethernet W5500 chip work with TCP Server mode]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7904</link>
			<pubDate>Thu, 03 Apr 2025 14:54:00 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7904</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * This Arduino program sets up an ESP32-S3 with a W5500 Ethernet module<br />
 * as a TCP server. It listens on port 4196 and echoes back any string <br />
 * received from a client.<br />
 *<br />
 * Hardware connections:<br />
 * - CLK: GPIO42<br />
 * - MOSI: GPIO43<br />
 * - MISO: GPIO44<br />
 * - CS: GPIO41<br />
 * - RST: GPIO1<br />
 * - INT: GPIO2<br />
 *<br />
 * Static IP address: 192.168.3.55<br />
 * Subnet Mask: 255.255.255.0<br />
 * Gateway: 192.168.3.1<br />
 * DNS: 192.168.3.1<br />
 */<br />
<br />
#include &lt;SPI.h&gt;<br />
#include &lt;Ethernet.h&gt;<br />
<br />
// Define the W5500 Ethernet module pins<br />
#define W5500_CS_PIN  42<br />
#define W5500_RST_PIN 44<br />
#define W5500_INT_PIN 43<br />
#define W5500_CLK_PIN 1<br />
#define W5500_MOSI_PIN 2<br />
#define W5500_MISO_PIN 41<br />
<br />
// MAC address for your Ethernet shield (must be unique on your network)<br />
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };<br />
<br />
// Static IP address configuration<br />
IPAddress ip(192, 168, 3, 55);     &nbsp;&nbsp;// Static IP address<br />
IPAddress subnet(255, 255, 255, 0); &nbsp;&nbsp;// Subnet mask<br />
IPAddress gateway(192, 168, 3, 1);    // Default gateway<br />
IPAddress dns(192, 168, 3, 1);        // DNS server address<br />
<br />
// Create an EthernetServer object to handle TCP connections<br />
EthernetServer server(4196);<br />
<br />
void setup() {<br />
  // Initialize serial communication<br />
  Serial.begin(115200);<br />
  while (!Serial) {<br />
    ; // Wait for serial port to connect<br />
  }<br />
<br />
  // Initialize the W5500 module<br />
  pinMode(W5500_RST_PIN, OUTPUT);<br />
  pinMode(W5500_INT_PIN, INPUT);<br />
  digitalWrite(W5500_RST_PIN, LOW);  // Reset the W5500 module<br />
  delay(100);                     &nbsp;&nbsp;// Wait for reset to complete<br />
  digitalWrite(W5500_RST_PIN, HIGH); // Release reset<br />
<br />
  // Initialize SPI with the correct pin definitions<br />
  SPI.begin(W5500_CLK_PIN, W5500_MISO_PIN, W5500_MOSI_PIN);<br />
<br />
  // Set up the Ethernet library with W5500-specific pins<br />
  Ethernet.init(W5500_CS_PIN);<br />
<br />
  // Start the Ethernet connection with static IP configuration<br />
  Ethernet.begin(mac, ip, dns, gateway, subnet);<br />
<br />
  // Print the IP address to the serial monitor<br />
  Serial.print("IP Address: ");<br />
  Serial.println(Ethernet.localIP());<br />
<br />
  // Start listening for incoming TCP connections<br />
  server.begin();<br />
}<br />
<br />
void loop() {<br />
  // Check for incoming client connections<br />
  EthernetClient client = server.available();<br />
  if (client) {<br />
    Serial.println("New client connected");<br />
<br />
    // Read data from the client and echo it back<br />
    while (client.connected()) {<br />
      if (client.available()) {<br />
        char c = client.read();<br />
        server.write(c);<br />
      }<br />
    }<br />
<br />
    // Close the connection when done<br />
    client.stop();<br />
    Serial.println("Client disconnected");<br />
  }<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7364" target="_blank" title="">7-Ethernet-W5500.zip</a> (Size: 1.23 KB / Downloads: 547)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7365" target="_blank" title="">7-Ethernet-W5500.ino.merged.zip</a> (Size: 191.07 KB / Downloads: 539)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * This Arduino program sets up an ESP32-S3 with a W5500 Ethernet module<br />
 * as a TCP server. It listens on port 4196 and echoes back any string <br />
 * received from a client.<br />
 *<br />
 * Hardware connections:<br />
 * - CLK: GPIO42<br />
 * - MOSI: GPIO43<br />
 * - MISO: GPIO44<br />
 * - CS: GPIO41<br />
 * - RST: GPIO1<br />
 * - INT: GPIO2<br />
 *<br />
 * Static IP address: 192.168.3.55<br />
 * Subnet Mask: 255.255.255.0<br />
 * Gateway: 192.168.3.1<br />
 * DNS: 192.168.3.1<br />
 */<br />
<br />
#include &lt;SPI.h&gt;<br />
#include &lt;Ethernet.h&gt;<br />
<br />
// Define the W5500 Ethernet module pins<br />
#define W5500_CS_PIN  42<br />
#define W5500_RST_PIN 44<br />
#define W5500_INT_PIN 43<br />
#define W5500_CLK_PIN 1<br />
#define W5500_MOSI_PIN 2<br />
#define W5500_MISO_PIN 41<br />
<br />
// MAC address for your Ethernet shield (must be unique on your network)<br />
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };<br />
<br />
// Static IP address configuration<br />
IPAddress ip(192, 168, 3, 55);     &nbsp;&nbsp;// Static IP address<br />
IPAddress subnet(255, 255, 255, 0); &nbsp;&nbsp;// Subnet mask<br />
IPAddress gateway(192, 168, 3, 1);    // Default gateway<br />
IPAddress dns(192, 168, 3, 1);        // DNS server address<br />
<br />
// Create an EthernetServer object to handle TCP connections<br />
EthernetServer server(4196);<br />
<br />
void setup() {<br />
  // Initialize serial communication<br />
  Serial.begin(115200);<br />
  while (!Serial) {<br />
    ; // Wait for serial port to connect<br />
  }<br />
<br />
  // Initialize the W5500 module<br />
  pinMode(W5500_RST_PIN, OUTPUT);<br />
  pinMode(W5500_INT_PIN, INPUT);<br />
  digitalWrite(W5500_RST_PIN, LOW);  // Reset the W5500 module<br />
  delay(100);                     &nbsp;&nbsp;// Wait for reset to complete<br />
  digitalWrite(W5500_RST_PIN, HIGH); // Release reset<br />
<br />
  // Initialize SPI with the correct pin definitions<br />
  SPI.begin(W5500_CLK_PIN, W5500_MISO_PIN, W5500_MOSI_PIN);<br />
<br />
  // Set up the Ethernet library with W5500-specific pins<br />
  Ethernet.init(W5500_CS_PIN);<br />
<br />
  // Start the Ethernet connection with static IP configuration<br />
  Ethernet.begin(mac, ip, dns, gateway, subnet);<br />
<br />
  // Print the IP address to the serial monitor<br />
  Serial.print("IP Address: ");<br />
  Serial.println(Ethernet.localIP());<br />
<br />
  // Start listening for incoming TCP connections<br />
  server.begin();<br />
}<br />
<br />
void loop() {<br />
  // Check for incoming client connections<br />
  EthernetClient client = server.available();<br />
  if (client) {<br />
    Serial.println("New client connected");<br />
<br />
    // Read data from the client and echo it back<br />
    while (client.connected()) {<br />
      if (client.available()) {<br />
        char c = client.read();<br />
        server.write(c);<br />
      }<br />
    }<br />
<br />
    // Close the connection when done<br />
    client.stop();<br />
    Serial.println("Client disconnected");<br />
  }<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7364" target="_blank" title="">7-Ethernet-W5500.zip</a> (Size: 1.23 KB / Downloads: 547)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7365" target="_blank" title="">7-Ethernet-W5500.ino.merged.zip</a> (Size: 191.07 KB / Downloads: 539)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for TA]-06 how to DS3231 RTC clock]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7903</link>
			<pubDate>Thu, 03 Apr 2025 14:52:27 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7903</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * DS3231 RTC with Arduino<br />
 *<br />
 * This program demonstrates how to use the DS3231 RTC (Real-Time Clock) module with the Arduino.<br />
 * It includes functionality to:<br />
 * - Initialize the DS3231 RTC module<br />
 * - Read the current date and time from the RTC<br />
 * - Set the RTC time based on a serial command:Command format: DYYYY-MM-DDTHH:MM:SS<br />
*    Set date and time command example: D2024-09-19T11:50:22<br />
*    print current date and time command: current time<br />
*<br />
 *<br />
 * Hardware Connections:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 */<br />
<br />
#include &lt;DS3231.h&gt;<br />
#include &lt;Wire.h&gt;<br />
<br />
String serial_cmd_rcv = ""; // Serial port receiver<br />
<br />
typedef struct<br />
{<br />
  byte year;    // Last two digits of the year, library adds 2000.<br />
  byte month;<br />
  byte day;<br />
  byte hour;<br />
  byte minute;<br />
  byte second;<br />
} MY_DATE_STR;<br />
<br />
MY_DATE_STR my_date_str = {0};<br />
<br />
// Define constants for relay control<br />
#define OPEN_RLY_DATA    26<br />
#define OPEN_RLY_MONTH &nbsp;&nbsp;4<br />
#define CLOSE_RLY_DATA &nbsp;&nbsp;2<br />
#define CLOSE_RLY_MONTH  5<br />
<br />
// Define pin connections<br />
#define SDA_PIN &nbsp;&nbsp;8<br />
#define SCL_PIN &nbsp;&nbsp;18<br />
<br />
DS3231 rtc; // Create an instance of the DS3231 RTC<br />
bool h12Flag;<br />
bool pmFlag;<br />
static bool bCentury = false;<br />
static bool old_level_high = false;<br />
static bool old_level_low = false;<br />
<br />
<br />
/**<br />
 * @brief Print the current time from the RTC to the Serial Monitor.<br />
 */<br />
static void PrintfCurTime()<br />
{<br />
  Serial.print("Current time is: ");<br />
  int year = rtc.getYear() + 2000;<br />
  Serial.print(year);<br />
  Serial.print("-");<br />
<br />
  Serial.print(rtc.getMonth(bCentury), DEC);<br />
  Serial.print("-");<br />
<br />
  Serial.print(rtc.getDate(), DEC);<br />
  Serial.print(" ");<br />
<br />
  Serial.print(rtc.getHour(h12Flag, pmFlag), DEC);<br />
  Serial.print(":");<br />
  Serial.print(rtc.getMinute(), DEC);<br />
  Serial.print(":");<br />
  Serial.println(rtc.getSecond(), DEC);<br />
}<br />
<br />
/**<br />
 * @brief Process serial commands to set the RTC time.<br />
 * Command format: DYYYY-MM-DDTHH:MM:SS<br />
 */<br />
static void GetSerialCmd()<br />
{<br />
  if (Serial.available() &gt; 0)<br />
  {<br />
    delay(100);<br />
    int num_read = Serial.available();<br />
    while (num_read--)<br />
      serial_cmd_rcv += char(Serial.read());<br />
  }<br />
  else return;<br />
<br />
  serial_cmd_rcv.trim();<br />
<br />
  if (serial_cmd_rcv == "current time")<br />
  {<br />
    PrintfCurTime();<br />
    serial_cmd_rcv = "";<br />
    return;<br />
  }<br />
<br />
  Serial.print("Received length: ");<br />
  Serial.println(serial_cmd_rcv.length());<br />
<br />
  int indexof_d = serial_cmd_rcv.indexOf('D');<br />
  int indexof_t = serial_cmd_rcv.indexOf('T');<br />
<br />
  Serial.print("D index: ");<br />
  Serial.print(indexof_d);<br />
  Serial.print(" T index: ");<br />
  Serial.println(indexof_t);<br />
<br />
  if (serial_cmd_rcv.length() != 20 || <br />
      serial_cmd_rcv.substring(0, 1) != "D" ||<br />
      serial_cmd_rcv.substring(11, 12) != "T")  <br />
  {<br />
    Serial.println(serial_cmd_rcv);<br />
    serial_cmd_rcv = "";<br />
    return;<br />
  }<br />
<br />
  Serial.println("Setting time...");<br />
<br />
  my_date_str.year = (byte)serial_cmd_rcv.substring(3, 5).toInt();<br />
  my_date_str.month = (byte)serial_cmd_rcv.substring(6, 8).toInt();<br />
  my_date_str.day = (byte)serial_cmd_rcv.substring(9, 11).toInt();<br />
  my_date_str.hour = (byte)serial_cmd_rcv.substring(12, 14).toInt();<br />
  my_date_str.minute = (byte)serial_cmd_rcv.substring(15, 17).toInt();<br />
  my_date_str.second = (byte)serial_cmd_rcv.substring(18).toInt();<br />
<br />
  rtc.setYear(my_date_str.year);<br />
  rtc.setMonth(my_date_str.month);<br />
  rtc.setDate(my_date_str.day);<br />
  rtc.setHour(my_date_str.hour);<br />
  rtc.setMinute(my_date_str.minute);<br />
  rtc.setSecond(my_date_str.second);<br />
<br />
  serial_cmd_rcv = "";<br />
<br />
  Serial.println("Time set.");<br />
}<br />
<br />
void setup() {<br />
  // Initialize the I2C interface<br />
  Wire.begin(SDA_PIN, SCL_PIN, 40000);<br />
  <br />
  // Initialize Serial communication<br />
  Serial.begin(115200);<br />
 &nbsp;&nbsp;<br />
  // Set the RTC to 24-hour mode<br />
  rtc.setClockMode(false); // 24-hour format<br />
<br />
  // Print current time to Serial Monitor<br />
  PrintfCurTime();<br />
<br />
  // Clear any remaining serial data<br />
  while (Serial.read() &gt;= 0) {}<br />
}<br />
<br />
void loop() {<br />
  // Process incoming serial commands<br />
  GetSerialCmd(); <br />
  delay(1000); // Delay for 1 second<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7362" target="_blank" title="">6-DS3231-RTC.zip</a> (Size: 1.56 KB / Downloads: 494)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7363" target="_blank" title="">6-DS3231-RTC.ino.merged.zip</a> (Size: 193.66 KB / Downloads: 528)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * DS3231 RTC with Arduino<br />
 *<br />
 * This program demonstrates how to use the DS3231 RTC (Real-Time Clock) module with the Arduino.<br />
 * It includes functionality to:<br />
 * - Initialize the DS3231 RTC module<br />
 * - Read the current date and time from the RTC<br />
 * - Set the RTC time based on a serial command:Command format: DYYYY-MM-DDTHH:MM:SS<br />
*    Set date and time command example: D2024-09-19T11:50:22<br />
*    print current date and time command: current time<br />
*<br />
 *<br />
 * Hardware Connections:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 */<br />
<br />
#include &lt;DS3231.h&gt;<br />
#include &lt;Wire.h&gt;<br />
<br />
String serial_cmd_rcv = ""; // Serial port receiver<br />
<br />
typedef struct<br />
{<br />
  byte year;    // Last two digits of the year, library adds 2000.<br />
  byte month;<br />
  byte day;<br />
  byte hour;<br />
  byte minute;<br />
  byte second;<br />
} MY_DATE_STR;<br />
<br />
MY_DATE_STR my_date_str = {0};<br />
<br />
// Define constants for relay control<br />
#define OPEN_RLY_DATA    26<br />
#define OPEN_RLY_MONTH &nbsp;&nbsp;4<br />
#define CLOSE_RLY_DATA &nbsp;&nbsp;2<br />
#define CLOSE_RLY_MONTH  5<br />
<br />
// Define pin connections<br />
#define SDA_PIN &nbsp;&nbsp;8<br />
#define SCL_PIN &nbsp;&nbsp;18<br />
<br />
DS3231 rtc; // Create an instance of the DS3231 RTC<br />
bool h12Flag;<br />
bool pmFlag;<br />
static bool bCentury = false;<br />
static bool old_level_high = false;<br />
static bool old_level_low = false;<br />
<br />
<br />
/**<br />
 * @brief Print the current time from the RTC to the Serial Monitor.<br />
 */<br />
static void PrintfCurTime()<br />
{<br />
  Serial.print("Current time is: ");<br />
  int year = rtc.getYear() + 2000;<br />
  Serial.print(year);<br />
  Serial.print("-");<br />
<br />
  Serial.print(rtc.getMonth(bCentury), DEC);<br />
  Serial.print("-");<br />
<br />
  Serial.print(rtc.getDate(), DEC);<br />
  Serial.print(" ");<br />
<br />
  Serial.print(rtc.getHour(h12Flag, pmFlag), DEC);<br />
  Serial.print(":");<br />
  Serial.print(rtc.getMinute(), DEC);<br />
  Serial.print(":");<br />
  Serial.println(rtc.getSecond(), DEC);<br />
}<br />
<br />
/**<br />
 * @brief Process serial commands to set the RTC time.<br />
 * Command format: DYYYY-MM-DDTHH:MM:SS<br />
 */<br />
static void GetSerialCmd()<br />
{<br />
  if (Serial.available() &gt; 0)<br />
  {<br />
    delay(100);<br />
    int num_read = Serial.available();<br />
    while (num_read--)<br />
      serial_cmd_rcv += char(Serial.read());<br />
  }<br />
  else return;<br />
<br />
  serial_cmd_rcv.trim();<br />
<br />
  if (serial_cmd_rcv == "current time")<br />
  {<br />
    PrintfCurTime();<br />
    serial_cmd_rcv = "";<br />
    return;<br />
  }<br />
<br />
  Serial.print("Received length: ");<br />
  Serial.println(serial_cmd_rcv.length());<br />
<br />
  int indexof_d = serial_cmd_rcv.indexOf('D');<br />
  int indexof_t = serial_cmd_rcv.indexOf('T');<br />
<br />
  Serial.print("D index: ");<br />
  Serial.print(indexof_d);<br />
  Serial.print(" T index: ");<br />
  Serial.println(indexof_t);<br />
<br />
  if (serial_cmd_rcv.length() != 20 || <br />
      serial_cmd_rcv.substring(0, 1) != "D" ||<br />
      serial_cmd_rcv.substring(11, 12) != "T")  <br />
  {<br />
    Serial.println(serial_cmd_rcv);<br />
    serial_cmd_rcv = "";<br />
    return;<br />
  }<br />
<br />
  Serial.println("Setting time...");<br />
<br />
  my_date_str.year = (byte)serial_cmd_rcv.substring(3, 5).toInt();<br />
  my_date_str.month = (byte)serial_cmd_rcv.substring(6, 8).toInt();<br />
  my_date_str.day = (byte)serial_cmd_rcv.substring(9, 11).toInt();<br />
  my_date_str.hour = (byte)serial_cmd_rcv.substring(12, 14).toInt();<br />
  my_date_str.minute = (byte)serial_cmd_rcv.substring(15, 17).toInt();<br />
  my_date_str.second = (byte)serial_cmd_rcv.substring(18).toInt();<br />
<br />
  rtc.setYear(my_date_str.year);<br />
  rtc.setMonth(my_date_str.month);<br />
  rtc.setDate(my_date_str.day);<br />
  rtc.setHour(my_date_str.hour);<br />
  rtc.setMinute(my_date_str.minute);<br />
  rtc.setSecond(my_date_str.second);<br />
<br />
  serial_cmd_rcv = "";<br />
<br />
  Serial.println("Time set.");<br />
}<br />
<br />
void setup() {<br />
  // Initialize the I2C interface<br />
  Wire.begin(SDA_PIN, SCL_PIN, 40000);<br />
  <br />
  // Initialize Serial communication<br />
  Serial.begin(115200);<br />
 &nbsp;&nbsp;<br />
  // Set the RTC to 24-hour mode<br />
  rtc.setClockMode(false); // 24-hour format<br />
<br />
  // Print current time to Serial Monitor<br />
  PrintfCurTime();<br />
<br />
  // Clear any remaining serial data<br />
  while (Serial.read() &gt;= 0) {}<br />
}<br />
<br />
void loop() {<br />
  // Process incoming serial commands<br />
  GetSerialCmd(); <br />
  delay(1000); // Delay for 1 second<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7362" target="_blank" title="">6-DS3231-RTC.zip</a> (Size: 1.56 KB / Downloads: 494)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7363" target="_blank" title="">6-DS3231-RTC.ino.merged.zip</a> (Size: 193.66 KB / Downloads: 528)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for TA]-05 Read free GPIO state]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7902</link>
			<pubDate>Thu, 03 Apr 2025 14:50:38 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7902</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * ESP32 GPIO State Reader<br />
 * Reads the state of 12 GPIOs and prints the results to the serial monitor.<br />
 * <br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 */<br />
<br />
#define GPIO_9 &nbsp;&nbsp;9<br />
#define GPIO_11  11<br />
#define GPIO_5 &nbsp;&nbsp;5<br />
#define GPIO_4 &nbsp;&nbsp;4<br />
#define GPIO_7 &nbsp;&nbsp;7<br />
#define GPIO_6 &nbsp;&nbsp;6<br />
#define GPIO_13  13<br />
#define GPIO_40  40<br />
#define GPIO_14  14<br />
#define GPIO_48  48<br />
#define GPIO_21  21<br />
#define GPIO_47  47<br />
<br />
void setup() {<br />
    Serial.begin(115200); // Initialize serial communication at 115200 baud rate<br />
    <br />
    // Set GPIOs as input<br />
    pinMode(GPIO_9, INPUT);<br />
    pinMode(GPIO_11, INPUT);<br />
    pinMode(GPIO_5, INPUT);<br />
    pinMode(GPIO_4, INPUT);<br />
    pinMode(GPIO_7, INPUT);<br />
    pinMode(GPIO_6, INPUT);<br />
    pinMode(GPIO_13, INPUT);<br />
    pinMode(GPIO_40, INPUT);<br />
    pinMode(GPIO_14, INPUT);<br />
    pinMode(GPIO_48, INPUT);<br />
    pinMode(GPIO_21, INPUT);<br />
    pinMode(GPIO_47, INPUT);<br />
}<br />
<br />
void loop() {<br />
    // Read GPIO states<br />
    int state_9  = digitalRead(GPIO_9);<br />
    int state_11 = digitalRead(GPIO_11);<br />
    int state_5  = digitalRead(GPIO_5);<br />
    int state_4  = digitalRead(GPIO_4);<br />
    int state_7  = digitalRead(GPIO_7);<br />
    int state_6  = digitalRead(GPIO_6);<br />
    int state_13 = digitalRead(GPIO_13);<br />
    int state_40 = digitalRead(GPIO_40);<br />
    int state_14 = digitalRead(GPIO_14);<br />
    int state_48 = digitalRead(GPIO_48);<br />
    int state_21 = digitalRead(GPIO_21);<br />
    int state_47 = digitalRead(GPIO_47);<br />
<br />
    // Print GPIO states to the serial monitor<br />
    Serial.printf("GPIO9: %d, GPIO11: %d, GPIO5: %d, GPIO4: %d, GPIO7: %d, GPIO6: %d, GPIO13: %d, GPIO40: %d, GPIO14: %d, GPIO48: %d, GPIO21: %d, GPIO47: %d&#92;n",<br />
                  state_9, state_11, state_5, state_4, state_7, state_6, state_13, state_40, state_14, state_48, state_21, state_47);<br />
    <br />
    delay(1000); // Read GPIO states every second<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7360" target="_blank" title="">5-free-gpio-state.zip</a> (Size: 737 bytes / Downloads: 530)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7361" target="_blank" title="">5-free-gpio-state.ino.merged.zip</a> (Size: 181.6 KB / Downloads: 552)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * ESP32 GPIO State Reader<br />
 * Reads the state of 12 GPIOs and prints the results to the serial monitor.<br />
 * <br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 */<br />
<br />
#define GPIO_9 &nbsp;&nbsp;9<br />
#define GPIO_11  11<br />
#define GPIO_5 &nbsp;&nbsp;5<br />
#define GPIO_4 &nbsp;&nbsp;4<br />
#define GPIO_7 &nbsp;&nbsp;7<br />
#define GPIO_6 &nbsp;&nbsp;6<br />
#define GPIO_13  13<br />
#define GPIO_40  40<br />
#define GPIO_14  14<br />
#define GPIO_48  48<br />
#define GPIO_21  21<br />
#define GPIO_47  47<br />
<br />
void setup() {<br />
    Serial.begin(115200); // Initialize serial communication at 115200 baud rate<br />
    <br />
    // Set GPIOs as input<br />
    pinMode(GPIO_9, INPUT);<br />
    pinMode(GPIO_11, INPUT);<br />
    pinMode(GPIO_5, INPUT);<br />
    pinMode(GPIO_4, INPUT);<br />
    pinMode(GPIO_7, INPUT);<br />
    pinMode(GPIO_6, INPUT);<br />
    pinMode(GPIO_13, INPUT);<br />
    pinMode(GPIO_40, INPUT);<br />
    pinMode(GPIO_14, INPUT);<br />
    pinMode(GPIO_48, INPUT);<br />
    pinMode(GPIO_21, INPUT);<br />
    pinMode(GPIO_47, INPUT);<br />
}<br />
<br />
void loop() {<br />
    // Read GPIO states<br />
    int state_9  = digitalRead(GPIO_9);<br />
    int state_11 = digitalRead(GPIO_11);<br />
    int state_5  = digitalRead(GPIO_5);<br />
    int state_4  = digitalRead(GPIO_4);<br />
    int state_7  = digitalRead(GPIO_7);<br />
    int state_6  = digitalRead(GPIO_6);<br />
    int state_13 = digitalRead(GPIO_13);<br />
    int state_40 = digitalRead(GPIO_40);<br />
    int state_14 = digitalRead(GPIO_14);<br />
    int state_48 = digitalRead(GPIO_48);<br />
    int state_21 = digitalRead(GPIO_21);<br />
    int state_47 = digitalRead(GPIO_47);<br />
<br />
    // Print GPIO states to the serial monitor<br />
    Serial.printf("GPIO9: %d, GPIO11: %d, GPIO5: %d, GPIO4: %d, GPIO7: %d, GPIO6: %d, GPIO13: %d, GPIO40: %d, GPIO14: %d, GPIO48: %d, GPIO21: %d, GPIO47: %d&#92;n",<br />
                  state_9, state_11, state_5, state_4, state_7, state_6, state_13, state_40, state_14, state_48, state_21, state_47);<br />
    <br />
    delay(1000); // Read GPIO states every second<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7360" target="_blank" title="">5-free-gpio-state.zip</a> (Size: 737 bytes / Downloads: 530)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7361" target="_blank" title="">5-free-gpio-state.ino.merged.zip</a> (Size: 181.6 KB / Downloads: 552)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for TA]-04 RS485 communication test]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7901</link>
			<pubDate>Thu, 03 Apr 2025 14:45:36 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7901</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * RS485 Communication Test<br />
 *<br />
 * This program is a simple test for RS485 communication using ESP32-S3.<br />
 * It will send a message over RS485 and then read incoming messages.<br />
 * The TXD pin is defined as GPIO 18 and RXD pin is defined as GPIO 8.<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Define RS485 pins<br />
#define RS485_RXD 38<br />
#define RS485_TXD 39<br />
<br />
// Create a hardware serial object<br />
HardwareSerial rs485Serial(1);<br />
<br />
void setup() {<br />
  // Start serial communication for debugging<br />
  Serial.begin(115200);<br />
  while (!Serial);<br />
<br />
  // Initialize RS485 Serial communication<br />
  rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);<br />
  <br />
  Serial.println("RS485 Test Start");<br />
}<br />
<br />
void loop() {<br />
  // Send a test message<br />
  rs485Serial.println("Hello from KinCony TA!");<br />
<br />
  // Wait for a short period<br />
  delay(1000);<br />
<br />
  // Check if data is available to read<br />
  if (rs485Serial.available()) {<br />
    String receivedMessage = "";<br />
    while (rs485Serial.available()) {<br />
      char c = rs485Serial.read();<br />
      receivedMessage += c;<br />
    }<br />
    // Print the received message<br />
    Serial.print("Received: ");<br />
    Serial.println(receivedMessage);<br />
  }<br />
<br />
  // Wait before sending the next message<br />
  delay(2000);<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7358" target="_blank" title="">4-RS485-Test.zip</a> (Size: 762 bytes / Downloads: 506)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7359" target="_blank" title="">4-RS485-Test.ino.merged.zip</a> (Size: 186.54 KB / Downloads: 505)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * RS485 Communication Test<br />
 *<br />
 * This program is a simple test for RS485 communication using ESP32-S3.<br />
 * It will send a message over RS485 and then read incoming messages.<br />
 * The TXD pin is defined as GPIO 18 and RXD pin is defined as GPIO 8.<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Define RS485 pins<br />
#define RS485_RXD 38<br />
#define RS485_TXD 39<br />
<br />
// Create a hardware serial object<br />
HardwareSerial rs485Serial(1);<br />
<br />
void setup() {<br />
  // Start serial communication for debugging<br />
  Serial.begin(115200);<br />
  while (!Serial);<br />
<br />
  // Initialize RS485 Serial communication<br />
  rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);<br />
  <br />
  Serial.println("RS485 Test Start");<br />
}<br />
<br />
void loop() {<br />
  // Send a test message<br />
  rs485Serial.println("Hello from KinCony TA!");<br />
<br />
  // Wait for a short period<br />
  delay(1000);<br />
<br />
  // Check if data is available to read<br />
  if (rs485Serial.available()) {<br />
    String receivedMessage = "";<br />
    while (rs485Serial.available()) {<br />
      char c = rs485Serial.read();<br />
      receivedMessage += c;<br />
    }<br />
    // Print the received message<br />
    Serial.print("Received: ");<br />
    Serial.println(receivedMessage);<br />
  }<br />
<br />
  // Wait before sending the next message<br />
  delay(2000);<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7358" target="_blank" title="">4-RS485-Test.zip</a> (Size: 762 bytes / Downloads: 506)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7359" target="_blank" title="">4-RS485-Test.ino.merged.zip</a> (Size: 186.54 KB / Downloads: 505)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for TA]-03 RF433MHz signal decode]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7900</link>
			<pubDate>Thu, 03 Apr 2025 14:43:18 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7900</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
  Simple example for receiving<br />
  <br />
  https://github.com/sui77/rc-switch/<br />
*/<br />
<br />
#include &lt;RCSwitch.h&gt;<br />
<br />
RCSwitch mySwitch = RCSwitch();<br />
<br />
void setup() {<br />
  Serial.begin(9600);<br />
  mySwitch.enableReceive(digitalPinToInterrupt(12)); <br />
  Serial.print("begin test");<br />
}<br />
<br />
void loop() {<br />
  if (mySwitch.available()) {<br />
    <br />
    Serial.print("Received ");<br />
    Serial.print( mySwitch.getReceivedValue() );<br />
    Serial.print(" / ");<br />
    Serial.print( mySwitch.getReceivedBitlength() );<br />
    Serial.print("bit ");<br />
    Serial.print("Protocol: ");<br />
    Serial.println( mySwitch.getReceivedProtocol() );<br />
<br />
    mySwitch.resetAvailable();<br />
  }<br />
}</code></div></div> arduino ino file download: <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7356" target="_blank" title="">3-433-decode.zip</a> (Size: 455 bytes / Downloads: 540)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7357" target="_blank" title="">3-433-decode.ino.merged.zip</a> (Size: 183.33 KB / Downloads: 541)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
  Simple example for receiving<br />
  <br />
  https://github.com/sui77/rc-switch/<br />
*/<br />
<br />
#include &lt;RCSwitch.h&gt;<br />
<br />
RCSwitch mySwitch = RCSwitch();<br />
<br />
void setup() {<br />
  Serial.begin(9600);<br />
  mySwitch.enableReceive(digitalPinToInterrupt(12)); <br />
  Serial.print("begin test");<br />
}<br />
<br />
void loop() {<br />
  if (mySwitch.available()) {<br />
    <br />
    Serial.print("Received ");<br />
    Serial.print( mySwitch.getReceivedValue() );<br />
    Serial.print(" / ");<br />
    Serial.print( mySwitch.getReceivedBitlength() );<br />
    Serial.print("bit ");<br />
    Serial.print("Protocol: ");<br />
    Serial.println( mySwitch.getReceivedProtocol() );<br />
<br />
    mySwitch.resetAvailable();<br />
  }<br />
}</code></div></div> arduino ino file download: <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7356" target="_blank" title="">3-433-decode.zip</a> (Size: 455 bytes / Downloads: 540)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7357" target="_blank" title="">3-433-decode.ino.merged.zip</a> (Size: 183.33 KB / Downloads: 541)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for TA]-02 Read digital input ports state]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7899</link>
			<pubDate>Thu, 03 Apr 2025 14:39:40 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7899</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * Description:<br />
 * This Arduino program reads the state of a 16-channel PCF8575 I/O expander<br />
 * and prints the state of all input pins to the Serial Monitor. The state of <br />
 * each pin is represented as a bit in a 16-bit value, where each bit corresponds <br />
 * to an input pin. The program prints the input state in binary format.<br />
 *<br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * - PCF8575 I2C Address: 0x22<br />
 */<br />
<br />
#include "Arduino.h"<br />
#include "PCF8575.h"<br />
<br />
// Define I2C pins<br />
#define I2C_SDA 8  // Define SDA pin<br />
#define I2C_SCL 18  // Define SCL pin<br />
<br />
// Set I2C address<br />
PCF8575 pcf8575_IN1(0x22); // The I2C address of the PCF8575<br />
<br />
void setup() {<br />
    Serial.begin(115200);<br />
<br />
    // Initialize I2C communication<br />
    Wire.begin(I2C_SDA, I2C_SCL); // Initialize I2C with defined SDA and SCL pins<br />
<br />
    pcf8575_IN1.begin(); // Initialize the PCF8575<br />
<br />
    Serial.println("KinCony TA 12 channel input state 0:ON  1:OFF");<br />
}<br />
<br />
void loop() {<br />
    uint16_t state = 0;<br />
<br />
    // Read the state of each pin (assuming 16 pins)<br />
    for (int pin = 0; pin &lt; 12; pin++) {<br />
        if (pcf8575_IN1.read(pin)) {<br />
            state |= (1 &lt;&lt; pin); // Set the bit for the active pin<br />
        }<br />
    }<br />
<br />
    Serial.print("Input state: ");<br />
    Serial.println(state, BIN); // Print the state of inputs in binary<br />
<br />
    delay(500); // Delay 500ms<br />
}</code></div></div> arduino ino file download: <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7354" target="_blank" title="">2-digital-input.zip</a> (Size: 837 bytes / Downloads: 501)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7355" target="_blank" title="">2-digital-input.ino.merged.zip</a> (Size: 192.29 KB / Downloads: 540)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * Description:<br />
 * This Arduino program reads the state of a 16-channel PCF8575 I/O expander<br />
 * and prints the state of all input pins to the Serial Monitor. The state of <br />
 * each pin is represented as a bit in a 16-bit value, where each bit corresponds <br />
 * to an input pin. The program prints the input state in binary format.<br />
 *<br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * - PCF8575 I2C Address: 0x22<br />
 */<br />
<br />
#include "Arduino.h"<br />
#include "PCF8575.h"<br />
<br />
// Define I2C pins<br />
#define I2C_SDA 8  // Define SDA pin<br />
#define I2C_SCL 18  // Define SCL pin<br />
<br />
// Set I2C address<br />
PCF8575 pcf8575_IN1(0x22); // The I2C address of the PCF8575<br />
<br />
void setup() {<br />
    Serial.begin(115200);<br />
<br />
    // Initialize I2C communication<br />
    Wire.begin(I2C_SDA, I2C_SCL); // Initialize I2C with defined SDA and SCL pins<br />
<br />
    pcf8575_IN1.begin(); // Initialize the PCF8575<br />
<br />
    Serial.println("KinCony TA 12 channel input state 0:ON  1:OFF");<br />
}<br />
<br />
void loop() {<br />
    uint16_t state = 0;<br />
<br />
    // Read the state of each pin (assuming 16 pins)<br />
    for (int pin = 0; pin &lt; 12; pin++) {<br />
        if (pcf8575_IN1.read(pin)) {<br />
            state |= (1 &lt;&lt; pin); // Set the bit for the active pin<br />
        }<br />
    }<br />
<br />
    Serial.print("Input state: ");<br />
    Serial.println(state, BIN); // Print the state of inputs in binary<br />
<br />
    delay(500); // Delay 500ms<br />
}</code></div></div> arduino ino file download: <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7354" target="_blank" title="">2-digital-input.zip</a> (Size: 837 bytes / Downloads: 501)
<!-- end: postbit_attachments_attachment --><br />
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7355" target="_blank" title="">2-digital-input.ino.merged.zip</a> (Size: 192.29 KB / Downloads: 540)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
	</channel>
</rss>