<?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 - T64M]]></title>
		<link>https://www.kincony.com/forum/</link>
		<description><![CDATA[Smart Home Automation Forum - https://www.kincony.com/forum]]></description>
		<pubDate>Tue, 19 May 2026 07:49:26 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[T64M Smart Controller Wiring Examples]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=9278</link>
			<pubDate>Mon, 20 Apr 2026 13:38:11 +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=9278</guid>
			<description><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9660" target="_blank" title="">T64M_wiring.jpg</a> (Size: 229.09 KB / Downloads: 68)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9660" target="_blank" title="">T64M_wiring.jpg</a> (Size: 229.09 KB / Downloads: 68)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[T64M Smart Controller ESP32 system block diagram]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=9276</link>
			<pubDate>Mon, 20 Apr 2026 13:34: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=9276</guid>
			<description><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9658" target="_blank" title="">KinCony-T64M-smart-controller-diagram.png</a> (Size: 774.21 KB / Downloads: 64)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9658" target="_blank" title="">KinCony-T64M-smart-controller-diagram.png</a> (Size: 774.21 KB / Downloads: 64)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Digital Input Voltage]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=9022</link>
			<pubDate>Wed, 04 Feb 2026 16:36:06 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=10364">wojtekkk87</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=9022</guid>
			<description><![CDATA[What is the acceptable Voltage range for the Digital Inputs?]]></description>
			<content:encoded><![CDATA[What is the acceptable Voltage range for the Digital Inputs?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Release Dates for T64M and T128M]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8056</link>
			<pubDate>Tue, 06 May 2025 22:51:10 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=3528">krosand</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8056</guid>
			<description><![CDATA[Hello everyone,<br />
<br />
Could you please let us know when the T64M and T128M will be released?<br />
Thank you for your feedback.<br />
Have a great day.]]></description>
			<content:encoded><![CDATA[Hello everyone,<br />
<br />
Could you please let us know when the T64M and T128M will be released?<br />
Thank you for your feedback.<br />
Have a great day.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-08 read analog input ports]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8011</link>
			<pubDate>Thu, 24 Apr 2025 09:10: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=8011</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 analog values from four analog input pins (A1, A2, A3, A4)<br />
 * and prints the values to the Serial Monitor. The analog inputs are defined with specific<br />
 * GPIO pins and the program reads the voltage levels from these pins every 2 seconds.<br />
 *<br />
 * Pin Definitions:<br />
 * - A1: GPIO 7<br />
 * - A2: GPIO 6<br />
 * - A3: GPIO 5<br />
 * - A4: GPIO 4<br />
 */<br />
<br />
#define ANALOG_A1 &nbsp;&nbsp;7 &nbsp;&nbsp;// Define GPIO pin for analog input A1<br />
#define ANALOG_A2 &nbsp;&nbsp;6 &nbsp;&nbsp;// Define GPIO pin for analog input A2<br />
#define ANALOG_A3 &nbsp;&nbsp;5 &nbsp;&nbsp;// Define GPIO pin for analog input A3<br />
#define ANALOG_A4 &nbsp;&nbsp;4 &nbsp;&nbsp;// Define GPIO pin for analog input A4<br />
<br />
void setup()<br />
{<br />
    Serial.begin(115200); // Initialize serial communication at 115200 baud rate<br />
    delay(500); // Short delay to allow serial communication to start<br />
<br />
    pinMode(ANALOG_A1, INPUT); // Set GPIO 5 as an input for analog signal A1<br />
    pinMode(ANALOG_A2, INPUT); // Set GPIO 7 as an input for analog signal A2<br />
    pinMode(ANALOG_A3, INPUT); // Set GPIO 6 as an input for analog signal A3<br />
    pinMode(ANALOG_A4, INPUT); // Set GPIO 4 as an input for analog signal A4<br />
}<br />
<br />
void loop()<br />
{<br />
    // Read and print analog values from the defined pins<br />
    Serial.print("A1="); <br />
    Serial.println(analogRead(ANALOG_A1)); // Read and print the value from A1<br />
    Serial.print("A2=");<br />
    Serial.println(analogRead(ANALOG_A2)); // Read and print the value from A2<br />
    Serial.print("A3=");<br />
    Serial.println(analogRead(ANALOG_A3)); // Read and print the value from A3<br />
    Serial.print("A4=");<br />
    Serial.println(analogRead(ANALOG_A4)); // Read and print the value from A4<br />
    <br />
    delay(2000); // Wait for 2 seconds before the next reading<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=7564" target="_blank" title="">8-analog-input.zip</a> (Size: 768 bytes / Downloads: 467)
<!-- 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=7565" target="_blank" title="">8-analog-input.ino.merged.zip</a> (Size: 187.2 KB / Downloads: 473)
<!-- 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 analog values from four analog input pins (A1, A2, A3, A4)<br />
 * and prints the values to the Serial Monitor. The analog inputs are defined with specific<br />
 * GPIO pins and the program reads the voltage levels from these pins every 2 seconds.<br />
 *<br />
 * Pin Definitions:<br />
 * - A1: GPIO 7<br />
 * - A2: GPIO 6<br />
 * - A3: GPIO 5<br />
 * - A4: GPIO 4<br />
 */<br />
<br />
#define ANALOG_A1 &nbsp;&nbsp;7 &nbsp;&nbsp;// Define GPIO pin for analog input A1<br />
#define ANALOG_A2 &nbsp;&nbsp;6 &nbsp;&nbsp;// Define GPIO pin for analog input A2<br />
#define ANALOG_A3 &nbsp;&nbsp;5 &nbsp;&nbsp;// Define GPIO pin for analog input A3<br />
#define ANALOG_A4 &nbsp;&nbsp;4 &nbsp;&nbsp;// Define GPIO pin for analog input A4<br />
<br />
void setup()<br />
{<br />
    Serial.begin(115200); // Initialize serial communication at 115200 baud rate<br />
    delay(500); // Short delay to allow serial communication to start<br />
<br />
    pinMode(ANALOG_A1, INPUT); // Set GPIO 5 as an input for analog signal A1<br />
    pinMode(ANALOG_A2, INPUT); // Set GPIO 7 as an input for analog signal A2<br />
    pinMode(ANALOG_A3, INPUT); // Set GPIO 6 as an input for analog signal A3<br />
    pinMode(ANALOG_A4, INPUT); // Set GPIO 4 as an input for analog signal A4<br />
}<br />
<br />
void loop()<br />
{<br />
    // Read and print analog values from the defined pins<br />
    Serial.print("A1="); <br />
    Serial.println(analogRead(ANALOG_A1)); // Read and print the value from A1<br />
    Serial.print("A2=");<br />
    Serial.println(analogRead(ANALOG_A2)); // Read and print the value from A2<br />
    Serial.print("A3=");<br />
    Serial.println(analogRead(ANALOG_A3)); // Read and print the value from A3<br />
    Serial.print("A4=");<br />
    Serial.println(analogRead(ANALOG_A4)); // Read and print the value from A4<br />
    <br />
    delay(2000); // Wait for 2 seconds before the next reading<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=7564" target="_blank" title="">8-analog-input.zip</a> (Size: 768 bytes / Downloads: 467)
<!-- 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=7565" target="_blank" title="">8-analog-input.ino.merged.zip</a> (Size: 187.2 KB / Downloads: 473)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-07 i2c scanner search online devices]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8005</link>
			<pubDate>Sun, 20 Apr 2025 15:45:29 +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=8005</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// Made by KinCony IoT: https://www.kincony.com<br />
// This sketch scans two I2C buses and prints all detected device addresses.<br />
// IIC Bus-1: SDA - GPIO48, SCL - GPIO47<br />
// IIC Bus-2: SDA - GPIO12, SCL - GPIO11<br />
<br />
#include &lt;Wire.h&gt;<br />
<br />
// Create two I2C bus objects<br />
TwoWire I2C_BUS1 = TwoWire(0);<br />
TwoWire I2C_BUS2 = TwoWire(1);<br />
<br />
// Scan function for a specific I2C bus<br />
void scanI2CBus(TwoWire &amp;bus, const char* busName) {<br />
  Serial.println();<br />
  Serial.print("Scanning ");<br />
  Serial.print(busName);<br />
  Serial.println(" at 100kHz...");<br />
<br />
  byte error, address;<br />
  int nDevices = 0;<br />
<br />
  for (address = 1; address &lt; 127; address++) {<br />
    bus.beginTransmission(address);<br />
    error = bus.endTransmission();<br />
<br />
    if (error == 0) {<br />
      Serial.print("I2C device found at address 0x");<br />
      if (address &lt; 16)<br />
        Serial.print("0");<br />
      Serial.print(address, HEX);<br />
      Serial.println("  ✓");<br />
      nDevices++;<br />
    } else if (error == 4) {<br />
      Serial.print("Unknown error at address 0x");<br />
      if (address &lt; 16)<br />
        Serial.print("0");<br />
      Serial.println(address, HEX);<br />
    }<br />
  }<br />
<br />
  if (nDevices == 0)<br />
    Serial.println("No I2C devices found.");<br />
  else<br />
    Serial.println("Scan completed.");<br />
}<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  delay(1000); // Wait for serial to initialize<br />
<br />
  // Initialize IIC Bus-1 (GPIO48 = SDA, GPIO47 = SCL) at 100kHz<br />
  I2C_BUS1.begin(48, 47);<br />
<br />
  // Initialize IIC Bus-2 (GPIO12 = SDA, GPIO11 = SCL) at 100kHz<br />
  I2C_BUS2.begin(12, 11);<br />
<br />
  // Start scanning both buses<br />
  scanI2CBus(I2C_BUS1, "IIC Bus-1");<br />
  scanI2CBus(I2C_BUS2, "IIC Bus-2");<br />
}<br />
<br />
void loop() {<br />
  // Nothing to do in the loop<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=7536" target="_blank" title="">7-i2c-scanner.zip</a> (Size: 841 bytes / Downloads: 433)
<!-- 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=7537" target="_blank" title="">7-i2c-scanner.ino.merged.zip</a> (Size: 192.17 KB / Downloads: 441)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// Made by KinCony IoT: https://www.kincony.com<br />
// This sketch scans two I2C buses and prints all detected device addresses.<br />
// IIC Bus-1: SDA - GPIO48, SCL - GPIO47<br />
// IIC Bus-2: SDA - GPIO12, SCL - GPIO11<br />
<br />
#include &lt;Wire.h&gt;<br />
<br />
// Create two I2C bus objects<br />
TwoWire I2C_BUS1 = TwoWire(0);<br />
TwoWire I2C_BUS2 = TwoWire(1);<br />
<br />
// Scan function for a specific I2C bus<br />
void scanI2CBus(TwoWire &amp;bus, const char* busName) {<br />
  Serial.println();<br />
  Serial.print("Scanning ");<br />
  Serial.print(busName);<br />
  Serial.println(" at 100kHz...");<br />
<br />
  byte error, address;<br />
  int nDevices = 0;<br />
<br />
  for (address = 1; address &lt; 127; address++) {<br />
    bus.beginTransmission(address);<br />
    error = bus.endTransmission();<br />
<br />
    if (error == 0) {<br />
      Serial.print("I2C device found at address 0x");<br />
      if (address &lt; 16)<br />
        Serial.print("0");<br />
      Serial.print(address, HEX);<br />
      Serial.println("  ✓");<br />
      nDevices++;<br />
    } else if (error == 4) {<br />
      Serial.print("Unknown error at address 0x");<br />
      if (address &lt; 16)<br />
        Serial.print("0");<br />
      Serial.println(address, HEX);<br />
    }<br />
  }<br />
<br />
  if (nDevices == 0)<br />
    Serial.println("No I2C devices found.");<br />
  else<br />
    Serial.println("Scan completed.");<br />
}<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  delay(1000); // Wait for serial to initialize<br />
<br />
  // Initialize IIC Bus-1 (GPIO48 = SDA, GPIO47 = SCL) at 100kHz<br />
  I2C_BUS1.begin(48, 47);<br />
<br />
  // Initialize IIC Bus-2 (GPIO12 = SDA, GPIO11 = SCL) at 100kHz<br />
  I2C_BUS2.begin(12, 11);<br />
<br />
  // Start scanning both buses<br />
  scanI2CBus(I2C_BUS1, "IIC Bus-1");<br />
  scanI2CBus(I2C_BUS2, "IIC Bus-2");<br />
}<br />
<br />
void loop() {<br />
  // Nothing to do in the loop<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=7536" target="_blank" title="">7-i2c-scanner.zip</a> (Size: 841 bytes / Downloads: 433)
<!-- 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=7537" target="_blank" title="">7-i2c-scanner.ino.merged.zip</a> (Size: 192.17 KB / Downloads: 441)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-06 digital INPUT trigger OUTPUT directly]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8004</link>
			<pubDate>Sun, 20 Apr 2025 15:44:21 +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=8004</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 reads 64 input channels from 4 PCF8575 modules on I2C Bus-2<br />
 * and controls 64 output channels on 4 PCF8575 modules on I2C Bus-1.<br />
 * When an input pin is pulled LOW (connected to GND), the corresponding output relay is turned ON (LOW).<br />
 * Otherwise, the relay is turned OFF (HIGH).<br />
 *<br />
 * I2C Bus-1 (Outputs):<br />
 * - SDA: GPIO 48<br />
 * - SCL: GPIO 47<br />
 * - Output1~16  : 0x25<br />
 * - Output17~32 : 0x24<br />
 * - Output33~48 : 0x21<br />
 * - Output49~64 : 0x20<br />
 *<br />
 * I2C Bus-2 (Inputs):<br />
 * - SDA: GPIO 12<br />
 * - SCL: GPIO 11<br />
 * - Input1~16 &nbsp;&nbsp;: 0x25<br />
 * - Input17~32  : 0x24<br />
 * - Input33~48  : 0x21<br />
 * - Input49~64  : 0x20<br />
 */<br />
<br />
#include &lt;Wire.h&gt;<br />
#include &lt;PCF8575.h&gt;<br />
<br />
// === Create two independent Wire objects ===<br />
TwoWire I2C_Output = TwoWire(0);  // I2C Bus 1 - for output control<br />
TwoWire I2C_Input  = TwoWire(1);  // I2C Bus 2 - for reading inputs<br />
<br />
// === Output PCF8575 modules (connected to relays) ===<br />
PCF8575 output_1(0x25, &amp;I2C_Output);  // Output 1-16<br />
PCF8575 output_2(0x24, &amp;I2C_Output);  // Output 17-32<br />
PCF8575 output_3(0x21, &amp;I2C_Output);  // Output 33-48<br />
PCF8575 output_4(0x20, &amp;I2C_Output);  // Output 49-64<br />
<br />
// === Input PCF8575 modules ===<br />
PCF8575 input_1(0x25, &amp;I2C_Input);    // Input 1-16<br />
PCF8575 input_2(0x24, &amp;I2C_Input);    // Input 17-32<br />
PCF8575 input_3(0x21, &amp;I2C_Input);    // Input 33-48<br />
PCF8575 input_4(0x20, &amp;I2C_Input);    // Input 49-64<br />
<br />
// === Arrays to manage all input/output modules ===<br />
PCF8575* inputArray[4]  = { &amp;input_1, &amp;input_2, &amp;input_3, &amp;input_4 };<br />
PCF8575* outputArray[4] = { &amp;output_1, &amp;output_2, &amp;output_3, &amp;output_4 };<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  Serial.println("KinCony 64-Channel Input-Output Mapping Test");<br />
<br />
  // Initialize I2C buses<br />
  I2C_Output.begin(48, 47); // SDA: GPIO48, SCL: GPIO47<br />
  I2C_Input.begin(12, 11);  // SDA: GPIO12, SCL: GPIO11<br />
<br />
  // Initialize all PCF8575 modules<br />
  for (int i = 0; i &lt; 4; i++) {<br />
    inputArray[i]-&gt;begin();<br />
    outputArray[i]-&gt;begin();<br />
<br />
    // Initially turn off all relays (set to HIGH)<br />
    for (int j = 0; j &lt; 16; j++) {<br />
      outputArray[i]-&gt;write(j, HIGH);<br />
    }<br />
  }<br />
}<br />
<br />
void loop() {<br />
  for (int chip = 0; chip &lt; 4; chip++) {<br />
    for (int pin = 0; pin &lt; 16; pin++) {<br />
      int globalPin = chip * 16 + pin;  // 0~63<br />
      bool inputState = inputArray[chip]-&gt;read(pin);<br />
<br />
      // 0 = Signal present (connected to GND), relay ON (output LOW)<br />
      // 1 = No signal, relay OFF (output HIGH)<br />
      outputArray[chip]-&gt;write(pin, inputState ? HIGH : LOW);<br />
    }<br />
  }<br />
<br />
  delay(200); // Slight delay to avoid excessive reading<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=7534" target="_blank" title="">6-input-trigger-output.zip</a> (Size: 1.17 KB / Downloads: 453)
<!-- 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=7535" target="_blank" title="">6-input-trigger-output.ino.merged.zip</a> (Size: 192.34 KB / Downloads: 422)
<!-- 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 reads 64 input channels from 4 PCF8575 modules on I2C Bus-2<br />
 * and controls 64 output channels on 4 PCF8575 modules on I2C Bus-1.<br />
 * When an input pin is pulled LOW (connected to GND), the corresponding output relay is turned ON (LOW).<br />
 * Otherwise, the relay is turned OFF (HIGH).<br />
 *<br />
 * I2C Bus-1 (Outputs):<br />
 * - SDA: GPIO 48<br />
 * - SCL: GPIO 47<br />
 * - Output1~16  : 0x25<br />
 * - Output17~32 : 0x24<br />
 * - Output33~48 : 0x21<br />
 * - Output49~64 : 0x20<br />
 *<br />
 * I2C Bus-2 (Inputs):<br />
 * - SDA: GPIO 12<br />
 * - SCL: GPIO 11<br />
 * - Input1~16 &nbsp;&nbsp;: 0x25<br />
 * - Input17~32  : 0x24<br />
 * - Input33~48  : 0x21<br />
 * - Input49~64  : 0x20<br />
 */<br />
<br />
#include &lt;Wire.h&gt;<br />
#include &lt;PCF8575.h&gt;<br />
<br />
// === Create two independent Wire objects ===<br />
TwoWire I2C_Output = TwoWire(0);  // I2C Bus 1 - for output control<br />
TwoWire I2C_Input  = TwoWire(1);  // I2C Bus 2 - for reading inputs<br />
<br />
// === Output PCF8575 modules (connected to relays) ===<br />
PCF8575 output_1(0x25, &amp;I2C_Output);  // Output 1-16<br />
PCF8575 output_2(0x24, &amp;I2C_Output);  // Output 17-32<br />
PCF8575 output_3(0x21, &amp;I2C_Output);  // Output 33-48<br />
PCF8575 output_4(0x20, &amp;I2C_Output);  // Output 49-64<br />
<br />
// === Input PCF8575 modules ===<br />
PCF8575 input_1(0x25, &amp;I2C_Input);    // Input 1-16<br />
PCF8575 input_2(0x24, &amp;I2C_Input);    // Input 17-32<br />
PCF8575 input_3(0x21, &amp;I2C_Input);    // Input 33-48<br />
PCF8575 input_4(0x20, &amp;I2C_Input);    // Input 49-64<br />
<br />
// === Arrays to manage all input/output modules ===<br />
PCF8575* inputArray[4]  = { &amp;input_1, &amp;input_2, &amp;input_3, &amp;input_4 };<br />
PCF8575* outputArray[4] = { &amp;output_1, &amp;output_2, &amp;output_3, &amp;output_4 };<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  Serial.println("KinCony 64-Channel Input-Output Mapping Test");<br />
<br />
  // Initialize I2C buses<br />
  I2C_Output.begin(48, 47); // SDA: GPIO48, SCL: GPIO47<br />
  I2C_Input.begin(12, 11);  // SDA: GPIO12, SCL: GPIO11<br />
<br />
  // Initialize all PCF8575 modules<br />
  for (int i = 0; i &lt; 4; i++) {<br />
    inputArray[i]-&gt;begin();<br />
    outputArray[i]-&gt;begin();<br />
<br />
    // Initially turn off all relays (set to HIGH)<br />
    for (int j = 0; j &lt; 16; j++) {<br />
      outputArray[i]-&gt;write(j, HIGH);<br />
    }<br />
  }<br />
}<br />
<br />
void loop() {<br />
  for (int chip = 0; chip &lt; 4; chip++) {<br />
    for (int pin = 0; pin &lt; 16; pin++) {<br />
      int globalPin = chip * 16 + pin;  // 0~63<br />
      bool inputState = inputArray[chip]-&gt;read(pin);<br />
<br />
      // 0 = Signal present (connected to GND), relay ON (output LOW)<br />
      // 1 = No signal, relay OFF (output HIGH)<br />
      outputArray[chip]-&gt;write(pin, inputState ? HIGH : LOW);<br />
    }<br />
  }<br />
<br />
  delay(200); // Slight delay to avoid excessive reading<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=7534" target="_blank" title="">6-input-trigger-output.zip</a> (Size: 1.17 KB / Downloads: 453)
<!-- 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=7535" target="_blank" title="">6-input-trigger-output.ino.merged.zip</a> (Size: 192.34 KB / Downloads: 422)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-05 Ethernet W5500 chip work with TCP Server mode]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8002</link>
			<pubDate>Sun, 20 Apr 2025 15:40:58 +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=8002</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  41<br />
#define W5500_RST_PIN 1<br />
#define W5500_INT_PIN 2<br />
#define W5500_CLK_PIN 42<br />
#define W5500_MOSI_PIN 43<br />
#define W5500_MISO_PIN 44<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=7532" target="_blank" title="">5-Ethernet-W5500.zip</a> (Size: 1.23 KB / Downloads: 466)
<!-- 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=7533" target="_blank" title="">5-Ethernet-W5500.ino.merged.zip</a> (Size: 191.08 KB / Downloads: 450)
<!-- 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  41<br />
#define W5500_RST_PIN 1<br />
#define W5500_INT_PIN 2<br />
#define W5500_CLK_PIN 42<br />
#define W5500_MOSI_PIN 43<br />
#define W5500_MISO_PIN 44<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=7532" target="_blank" title="">5-Ethernet-W5500.zip</a> (Size: 1.23 KB / Downloads: 466)
<!-- 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=7533" target="_blank" title="">5-Ethernet-W5500.ino.merged.zip</a> (Size: 191.08 KB / Downloads: 450)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-04 Read free GPIO state]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8001</link>
			<pubDate>Sun, 20 Apr 2025 15:38:45 +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=8001</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 />
 * GPIO Status Monitoring<br />
 *<br />
 * This program monitors the status (high or low) of multiple GPIO pins on the ESP32-S3.<br />
 * It prints the status of the pins to the serial monitor whenever a change is detected.<br />
 *<br />
 * GPIO Pins Monitored:<br />
 * - GPIO 8<br />
 * - GPIO 9<br />
 * - GPIO 10<br />
 * - GPIO 15<br />
 * - GPIO 16<br />
 * - GPIO 17<br />
 * - GPIO 18<br />
 * - GPIO 0<br />
 *<br />
 * Hardware Requirements:<br />
 * - Connect the pins to appropriate devices or pull them to HIGH/LOW for testing<br />
 */<br />
<br />
#define GPIO_PIN_8 8<br />
#define GPIO_PIN_9 9<br />
#define GPIO_PIN_10 10<br />
#define GPIO_PIN_15 15<br />
#define GPIO_PIN_16 16<br />
#define GPIO_PIN_17 17<br />
#define GPIO_PIN_18 18<br />
#define GPIO_PIN_0 0<br />
<br />
// Store the previous state of the GPIO pins<br />
bool prevState[8] = {false, false, false, false, false, false, false, false};<br />
<br />
void setup() {<br />
  // Initialize serial communication for debugging purposes<br />
  Serial.begin(115200); // Initialize the serial monitor at 115200 baud<br />
  while (!Serial);      // Wait for the serial monitor to open<br />
<br />
  // Initialize GPIO pins as inputs<br />
  pinMode(GPIO_PIN_8, INPUT);<br />
  pinMode(GPIO_PIN_9, INPUT);<br />
  pinMode(GPIO_PIN_10, INPUT);<br />
  pinMode(GPIO_PIN_15, INPUT);<br />
  pinMode(GPIO_PIN_16, INPUT);<br />
  pinMode(GPIO_PIN_17, INPUT);<br />
  pinMode(GPIO_PIN_18, INPUT);<br />
  pinMode(GPIO_PIN_0, INPUT);<br />
<br />
  Serial.println("GPIO Status Monitoring Started");<br />
}<br />
<br />
void loop() {<br />
  // Read the current state of each GPIO pin<br />
  bool currentState[8];<br />
  currentState[0] = digitalRead(GPIO_PIN_8);<br />
  currentState[1] = digitalRead(GPIO_PIN_9);<br />
  currentState[2] = digitalRead(GPIO_PIN_10);<br />
  currentState[3] = digitalRead(GPIO_PIN_15);<br />
  currentState[4] = digitalRead(GPIO_PIN_16);<br />
  currentState[5] = digitalRead(GPIO_PIN_17);<br />
  currentState[6] = digitalRead(GPIO_PIN_18);<br />
  currentState[7] = digitalRead(GPIO_PIN_0);<br />
<br />
  // Check for changes in GPIO pin states<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    if (currentState[i] != prevState[i]) {<br />
      // Print the pin number and its new state if it has changed<br />
      Serial.print("GPIO ");<br />
      Serial.print(i == 0 ? GPIO_PIN_8 : <br />
                 &nbsp;&nbsp;i == 1 ? GPIO_PIN_9 : <br />
                 &nbsp;&nbsp;i == 2 ? GPIO_PIN_10 : <br />
                 &nbsp;&nbsp;i == 3 ? GPIO_PIN_15 : <br />
                 &nbsp;&nbsp;i == 4 ? GPIO_PIN_16 : <br />
                 &nbsp;&nbsp;i == 5 ? GPIO_PIN_17 : <br />
                 &nbsp;&nbsp;i == 6 ? GPIO_PIN_18 : GPIO_PIN_0);<br />
      Serial.print(" changed to ");<br />
      Serial.println(currentState[i] ? "HIGH" : "LOW");<br />
      // Update the previous state<br />
      prevState[i] = currentState[i];<br />
    }<br />
  }<br />
<br />
  // Delay to avoid flooding the serial monitor<br />
  delay(100); // Adjust the delay as needed<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=7530" target="_blank" title="">4-free-gpio-state.zip</a> (Size: 1.04 KB / Downloads: 411)
<!-- 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=7531" target="_blank" title="">4-free-gpio-state.ino.merged.zip</a> (Size: 181.77 KB / Downloads: 424)
<!-- 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 />
 * GPIO Status Monitoring<br />
 *<br />
 * This program monitors the status (high or low) of multiple GPIO pins on the ESP32-S3.<br />
 * It prints the status of the pins to the serial monitor whenever a change is detected.<br />
 *<br />
 * GPIO Pins Monitored:<br />
 * - GPIO 8<br />
 * - GPIO 9<br />
 * - GPIO 10<br />
 * - GPIO 15<br />
 * - GPIO 16<br />
 * - GPIO 17<br />
 * - GPIO 18<br />
 * - GPIO 0<br />
 *<br />
 * Hardware Requirements:<br />
 * - Connect the pins to appropriate devices or pull them to HIGH/LOW for testing<br />
 */<br />
<br />
#define GPIO_PIN_8 8<br />
#define GPIO_PIN_9 9<br />
#define GPIO_PIN_10 10<br />
#define GPIO_PIN_15 15<br />
#define GPIO_PIN_16 16<br />
#define GPIO_PIN_17 17<br />
#define GPIO_PIN_18 18<br />
#define GPIO_PIN_0 0<br />
<br />
// Store the previous state of the GPIO pins<br />
bool prevState[8] = {false, false, false, false, false, false, false, false};<br />
<br />
void setup() {<br />
  // Initialize serial communication for debugging purposes<br />
  Serial.begin(115200); // Initialize the serial monitor at 115200 baud<br />
  while (!Serial);      // Wait for the serial monitor to open<br />
<br />
  // Initialize GPIO pins as inputs<br />
  pinMode(GPIO_PIN_8, INPUT);<br />
  pinMode(GPIO_PIN_9, INPUT);<br />
  pinMode(GPIO_PIN_10, INPUT);<br />
  pinMode(GPIO_PIN_15, INPUT);<br />
  pinMode(GPIO_PIN_16, INPUT);<br />
  pinMode(GPIO_PIN_17, INPUT);<br />
  pinMode(GPIO_PIN_18, INPUT);<br />
  pinMode(GPIO_PIN_0, INPUT);<br />
<br />
  Serial.println("GPIO Status Monitoring Started");<br />
}<br />
<br />
void loop() {<br />
  // Read the current state of each GPIO pin<br />
  bool currentState[8];<br />
  currentState[0] = digitalRead(GPIO_PIN_8);<br />
  currentState[1] = digitalRead(GPIO_PIN_9);<br />
  currentState[2] = digitalRead(GPIO_PIN_10);<br />
  currentState[3] = digitalRead(GPIO_PIN_15);<br />
  currentState[4] = digitalRead(GPIO_PIN_16);<br />
  currentState[5] = digitalRead(GPIO_PIN_17);<br />
  currentState[6] = digitalRead(GPIO_PIN_18);<br />
  currentState[7] = digitalRead(GPIO_PIN_0);<br />
<br />
  // Check for changes in GPIO pin states<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    if (currentState[i] != prevState[i]) {<br />
      // Print the pin number and its new state if it has changed<br />
      Serial.print("GPIO ");<br />
      Serial.print(i == 0 ? GPIO_PIN_8 : <br />
                 &nbsp;&nbsp;i == 1 ? GPIO_PIN_9 : <br />
                 &nbsp;&nbsp;i == 2 ? GPIO_PIN_10 : <br />
                 &nbsp;&nbsp;i == 3 ? GPIO_PIN_15 : <br />
                 &nbsp;&nbsp;i == 4 ? GPIO_PIN_16 : <br />
                 &nbsp;&nbsp;i == 5 ? GPIO_PIN_17 : <br />
                 &nbsp;&nbsp;i == 6 ? GPIO_PIN_18 : GPIO_PIN_0);<br />
      Serial.print(" changed to ");<br />
      Serial.println(currentState[i] ? "HIGH" : "LOW");<br />
      // Update the previous state<br />
      prevState[i] = currentState[i];<br />
    }<br />
  }<br />
<br />
  // Delay to avoid flooding the serial monitor<br />
  delay(100); // Adjust the delay as needed<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=7530" target="_blank" title="">4-free-gpio-state.zip</a> (Size: 1.04 KB / Downloads: 411)
<!-- 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=7531" target="_blank" title="">4-free-gpio-state.ino.merged.zip</a> (Size: 181.77 KB / Downloads: 424)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-03 RS485 communication test]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8000</link>
			<pubDate>Sun, 20 Apr 2025 15:37:46 +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=8000</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 with Direction Control (SP3485EEN)<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 13, RXD is GPIO 21, and EN is GPIO 14.<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Define RS485 pins<br />
#define RS485_RXD 21   &nbsp;&nbsp;// RS485 Receive<br />
#define RS485_TXD 13   &nbsp;&nbsp;// RS485 Transmit<br />
#define RS485_EN  14   &nbsp;&nbsp;// RS485 Direction control (High: Send, Low: Receive)<br />
<br />
// Create a hardware serial object on UART1<br />
HardwareSerial rs485Serial(1);<br />
<br />
void setup() {<br />
  // Start serial communication for debugging<br />
  Serial.begin(115200);<br />
  while (!Serial);<br />
<br />
  // Set RS485 direction control pin<br />
  pinMode(RS485_EN, OUTPUT);<br />
  digitalWrite(RS485_EN, LOW); // Start in receive mode<br />
<br />
  // Initialize RS485 serial communication<br />
  rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);<br />
<br />
  Serial.println("RS485 Test Start (with direction control)");<br />
}<br />
<br />
void loop() {<br />
  // Prepare the message to send<br />
  String message = "Hello from KinCony T64M!";<br />
  <br />
  // Switch to transmit mode<br />
  digitalWrite(RS485_EN, HIGH);<br />
  delay(2); // Short delay to allow driver to switch<br />
  <br />
  // Send the message<br />
  rs485Serial.println(message);<br />
  rs485Serial.flush(); // Wait for transmission to complete<br />
  <br />
  // Switch back to receive mode<br />
  digitalWrite(RS485_EN, LOW);<br />
  <br />
  Serial.println("Message sent. Waiting for response...");<br />
<br />
  // Wait for a response (up to 1 second)<br />
  unsigned long startTime = millis();<br />
  while (millis() - startTime &lt; 1000) {<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 />
      break;<br />
    }<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=7528" target="_blank" title="">3-RS485-Test.zip</a> (Size: 1.02 KB / Downloads: 448)
<!-- 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=7529" target="_blank" title="">3-RS485-Test.ino.merged.zip</a> (Size: 186.66 KB / Downloads: 478)
<!-- 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 with Direction Control (SP3485EEN)<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 13, RXD is GPIO 21, and EN is GPIO 14.<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Define RS485 pins<br />
#define RS485_RXD 21   &nbsp;&nbsp;// RS485 Receive<br />
#define RS485_TXD 13   &nbsp;&nbsp;// RS485 Transmit<br />
#define RS485_EN  14   &nbsp;&nbsp;// RS485 Direction control (High: Send, Low: Receive)<br />
<br />
// Create a hardware serial object on UART1<br />
HardwareSerial rs485Serial(1);<br />
<br />
void setup() {<br />
  // Start serial communication for debugging<br />
  Serial.begin(115200);<br />
  while (!Serial);<br />
<br />
  // Set RS485 direction control pin<br />
  pinMode(RS485_EN, OUTPUT);<br />
  digitalWrite(RS485_EN, LOW); // Start in receive mode<br />
<br />
  // Initialize RS485 serial communication<br />
  rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);<br />
<br />
  Serial.println("RS485 Test Start (with direction control)");<br />
}<br />
<br />
void loop() {<br />
  // Prepare the message to send<br />
  String message = "Hello from KinCony T64M!";<br />
  <br />
  // Switch to transmit mode<br />
  digitalWrite(RS485_EN, HIGH);<br />
  delay(2); // Short delay to allow driver to switch<br />
  <br />
  // Send the message<br />
  rs485Serial.println(message);<br />
  rs485Serial.flush(); // Wait for transmission to complete<br />
  <br />
  // Switch back to receive mode<br />
  digitalWrite(RS485_EN, LOW);<br />
  <br />
  Serial.println("Message sent. Waiting for response...");<br />
<br />
  // Wait for a response (up to 1 second)<br />
  unsigned long startTime = millis();<br />
  while (millis() - startTime &lt; 1000) {<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 />
      break;<br />
    }<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=7528" target="_blank" title="">3-RS485-Test.zip</a> (Size: 1.02 KB / Downloads: 448)
<!-- 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=7529" target="_blank" title="">3-RS485-Test.ino.merged.zip</a> (Size: 186.66 KB / Downloads: 478)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-02 Read digital input ports state]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7999</link>
			<pubDate>Sun, 20 Apr 2025 15:35:51 +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=7999</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 64 input channels using 4 PCF8575 I/O expanders<br />
 * and prints the state of all input pins to the Serial Monitor. Each input state is printed<br />
 * in binary (0 = ON, 1 = OFF), grouped by 16 bits per chip.<br />
 *<br />
 * I2C Pin Definitions:<br />
 * - SDA: GPIO 12<br />
 * - SCL: GPIO 11<br />
 *<br />
 * PCF8575 Addresses:<br />
 * - Input  1~16 : 0x25<br />
 * - Input 17~32: 0x24<br />
 * - Input 33~48: 0x21<br />
 * - Input 49~64: 0x20<br />
 */<br />
<br />
#include &lt;Wire.h&gt;<br />
#include &lt;PCF8575.h&gt;<br />
<br />
// Define I2C pins<br />
#define SDA_PIN 12<br />
#define SCL_PIN 11<br />
<br />
// Create PCF8575 objects<br />
PCF8575 pcf_1(0x25); // Input  1-16<br />
PCF8575 pcf_2(0x24); // Input 17-32<br />
PCF8575 pcf_3(0x21); // Input 33-48<br />
PCF8575 pcf_4(0x20); // Input 49-64<br />
<br />
// Array of PCF8575 pointers<br />
PCF8575* pcfArray[4] = { &amp;pcf_1, &amp;pcf_2, &amp;pcf_3, &amp;pcf_4 };<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  Wire.begin(SDA_PIN, SCL_PIN); // Initialize I2C<br />
<br />
  // Initialize each PCF8575<br />
  for (int i = 0; i &lt; 4; i++) {<br />
    pcfArray[i]-&gt;begin();<br />
  }<br />
<br />
  Serial.println("KinCony F64 64 channel input state  0:ON  1:OFF");<br />
}<br />
<br />
void loop() {<br />
  Serial.println("Reading Inputs...");<br />
<br />
  for (int chip = 0; chip &lt; 4; chip++) {<br />
    uint16_t state = 0;<br />
<br />
    // Read 16 input pins per PCF8575<br />
    for (int pin = 0; pin &lt; 16; pin++) {<br />
      if (pcfArray[chip]-&gt;read(pin)) {<br />
        state |= (1 &lt;&lt; pin); // Bit = 1 means OFF (no signal), 0 means ON<br />
      }<br />
    }<br />
<br />
    // Display result<br />
    Serial.print("Input ");<br />
    Serial.print(chip * 16 + 1);<br />
    Serial.print("~");<br />
    Serial.print((chip + 1) * 16);<br />
    Serial.print(": ");<br />
    for (int b = 15; b &gt;= 0; b--) {<br />
      Serial.print(bitRead(state, b));<br />
    }<br />
    Serial.println();<br />
  }<br />
<br />
  Serial.println(); // Blank line between readings<br />
  delay(500);     &nbsp;&nbsp;// Wait 500ms before next read<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=7526" target="_blank" title="">2-digital-input.zip</a> (Size: 1.01 KB / Downloads: 426)
<!-- 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=7527" target="_blank" title="">2-digital-input.ino.merged.zip</a> (Size: 192.41 KB / Downloads: 428)
<!-- 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 64 input channels using 4 PCF8575 I/O expanders<br />
 * and prints the state of all input pins to the Serial Monitor. Each input state is printed<br />
 * in binary (0 = ON, 1 = OFF), grouped by 16 bits per chip.<br />
 *<br />
 * I2C Pin Definitions:<br />
 * - SDA: GPIO 12<br />
 * - SCL: GPIO 11<br />
 *<br />
 * PCF8575 Addresses:<br />
 * - Input  1~16 : 0x25<br />
 * - Input 17~32: 0x24<br />
 * - Input 33~48: 0x21<br />
 * - Input 49~64: 0x20<br />
 */<br />
<br />
#include &lt;Wire.h&gt;<br />
#include &lt;PCF8575.h&gt;<br />
<br />
// Define I2C pins<br />
#define SDA_PIN 12<br />
#define SCL_PIN 11<br />
<br />
// Create PCF8575 objects<br />
PCF8575 pcf_1(0x25); // Input  1-16<br />
PCF8575 pcf_2(0x24); // Input 17-32<br />
PCF8575 pcf_3(0x21); // Input 33-48<br />
PCF8575 pcf_4(0x20); // Input 49-64<br />
<br />
// Array of PCF8575 pointers<br />
PCF8575* pcfArray[4] = { &amp;pcf_1, &amp;pcf_2, &amp;pcf_3, &amp;pcf_4 };<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  Wire.begin(SDA_PIN, SCL_PIN); // Initialize I2C<br />
<br />
  // Initialize each PCF8575<br />
  for (int i = 0; i &lt; 4; i++) {<br />
    pcfArray[i]-&gt;begin();<br />
  }<br />
<br />
  Serial.println("KinCony F64 64 channel input state  0:ON  1:OFF");<br />
}<br />
<br />
void loop() {<br />
  Serial.println("Reading Inputs...");<br />
<br />
  for (int chip = 0; chip &lt; 4; chip++) {<br />
    uint16_t state = 0;<br />
<br />
    // Read 16 input pins per PCF8575<br />
    for (int pin = 0; pin &lt; 16; pin++) {<br />
      if (pcfArray[chip]-&gt;read(pin)) {<br />
        state |= (1 &lt;&lt; pin); // Bit = 1 means OFF (no signal), 0 means ON<br />
      }<br />
    }<br />
<br />
    // Display result<br />
    Serial.print("Input ");<br />
    Serial.print(chip * 16 + 1);<br />
    Serial.print("~");<br />
    Serial.print((chip + 1) * 16);<br />
    Serial.print(": ");<br />
    for (int b = 15; b &gt;= 0; b--) {<br />
      Serial.print(bitRead(state, b));<br />
    }<br />
    Serial.println();<br />
  }<br />
<br />
  Serial.println(); // Blank line between readings<br />
  delay(500);     &nbsp;&nbsp;// Wait 500ms before next read<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=7526" target="_blank" title="">2-digital-input.zip</a> (Size: 1.01 KB / Downloads: 426)
<!-- 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=7527" target="_blank" title="">2-digital-input.ino.merged.zip</a> (Size: 192.41 KB / Downloads: 428)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for T64M]-01 Turn ON/OFF OUTPUT]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7998</link>
			<pubDate>Sun, 20 Apr 2025 15:34: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=7998</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 program controls 64 outputs using 4 PCF8575 I/O expanders.<br />
 * It sequentially turns on outputs 1 to 64, then turns them off from 64 to 1, in a loop.<br />
 * <br />
 * I2C Pin Definitions:<br />
 * - SDA: GPIO 48<br />
 * - SCL: GPIO 47<br />
 *<br />
 * PCF8575 Addresses:<br />
 * - Output  1~16 : 0x25<br />
 * - Output 17~32: 0x24<br />
 * - Output 33~48: 0x21<br />
 * - Output 49~64: 0x20<br />
 *<br />
 * Delay Time:<br />
 * - 200 milliseconds between switching outputs<br />
 */<br />
<br />
#include &lt;Wire.h&gt;        // Include the Wire library for I2C communication<br />
#include &lt;PCF8575.h&gt;   &nbsp;&nbsp;// Include the PCF8575 library<br />
<br />
#define SDA_PIN 48     &nbsp;&nbsp;// Define SDA pin<br />
#define SCL_PIN 47     &nbsp;&nbsp;// Define SCL pin<br />
#define DELAY_TIME 200 &nbsp;&nbsp;// Delay between operations in milliseconds<br />
<br />
// Create PCF8575 objects for each chip<br />
PCF8575 pcf_1(0x25); // output  1-16<br />
PCF8575 pcf_2(0x24); // output 17-32<br />
PCF8575 pcf_3(0x21); // output 33-48<br />
PCF8575 pcf_4(0x20); // output 49-64<br />
<br />
// Array of pointers to PCF8575 objects<br />
PCF8575* pcfArray[4] = { &amp;pcf_1, &amp;pcf_2, &amp;pcf_3, &amp;pcf_4 };<br />
<br />
void setup() {<br />
  Wire.begin(SDA_PIN, SCL_PIN);  // Initialize I2C with specified pins<br />
  Serial.begin(115200);<br />
  Serial.println("PCF8575 64-Channel Output Control Starting...");<br />
<br />
  // Initialize all PCF8575 modules and set all pins to HIGH (OFF)<br />
  for (int i = 0; i &lt; 4; i++) {<br />
    pcfArray[i]-&gt;begin();<br />
    for (int j = 0; j &lt; 16; j++) {<br />
      pcfArray[i]-&gt;write(j, HIGH);  // Turn off all outputs initially<br />
    }<br />
  }<br />
}<br />
<br />
void loop() {<br />
  // Turn ON outputs from 1 to 64 (LOW)<br />
  for (int channel = 0; channel &lt; 64; channel++) {<br />
    int chipIndex = channel / 16;       &nbsp;&nbsp;// Which PCF8575 (0 to 3)<br />
    int pinIndex = channel % 16;          // Which pin on that PCF8575 (0 to 15)<br />
    pcfArray[chipIndex]-&gt;write(pinIndex, LOW); // Turn ON the output<br />
    delay(DELAY_TIME);<br />
  }<br />
<br />
  // Turn OFF outputs from 64 to 1 (HIGH)<br />
  for (int channel = 63; channel &gt;= 0; channel--) {<br />
    int chipIndex = channel / 16;<br />
    int pinIndex = channel % 16;<br />
    pcfArray[chipIndex]-&gt;write(pinIndex, HIGH); // Turn OFF the output<br />
    delay(DELAY_TIME);<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=7524" target="_blank" title="">1-output.zip</a> (Size: 1.03 KB / Downloads: 444)
<!-- 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=7525" target="_blank" title="">1-output.ino.merged.zip</a> (Size: 192.12 KB / Downloads: 424)
<!-- 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 program controls 64 outputs using 4 PCF8575 I/O expanders.<br />
 * It sequentially turns on outputs 1 to 64, then turns them off from 64 to 1, in a loop.<br />
 * <br />
 * I2C Pin Definitions:<br />
 * - SDA: GPIO 48<br />
 * - SCL: GPIO 47<br />
 *<br />
 * PCF8575 Addresses:<br />
 * - Output  1~16 : 0x25<br />
 * - Output 17~32: 0x24<br />
 * - Output 33~48: 0x21<br />
 * - Output 49~64: 0x20<br />
 *<br />
 * Delay Time:<br />
 * - 200 milliseconds between switching outputs<br />
 */<br />
<br />
#include &lt;Wire.h&gt;        // Include the Wire library for I2C communication<br />
#include &lt;PCF8575.h&gt;   &nbsp;&nbsp;// Include the PCF8575 library<br />
<br />
#define SDA_PIN 48     &nbsp;&nbsp;// Define SDA pin<br />
#define SCL_PIN 47     &nbsp;&nbsp;// Define SCL pin<br />
#define DELAY_TIME 200 &nbsp;&nbsp;// Delay between operations in milliseconds<br />
<br />
// Create PCF8575 objects for each chip<br />
PCF8575 pcf_1(0x25); // output  1-16<br />
PCF8575 pcf_2(0x24); // output 17-32<br />
PCF8575 pcf_3(0x21); // output 33-48<br />
PCF8575 pcf_4(0x20); // output 49-64<br />
<br />
// Array of pointers to PCF8575 objects<br />
PCF8575* pcfArray[4] = { &amp;pcf_1, &amp;pcf_2, &amp;pcf_3, &amp;pcf_4 };<br />
<br />
void setup() {<br />
  Wire.begin(SDA_PIN, SCL_PIN);  // Initialize I2C with specified pins<br />
  Serial.begin(115200);<br />
  Serial.println("PCF8575 64-Channel Output Control Starting...");<br />
<br />
  // Initialize all PCF8575 modules and set all pins to HIGH (OFF)<br />
  for (int i = 0; i &lt; 4; i++) {<br />
    pcfArray[i]-&gt;begin();<br />
    for (int j = 0; j &lt; 16; j++) {<br />
      pcfArray[i]-&gt;write(j, HIGH);  // Turn off all outputs initially<br />
    }<br />
  }<br />
}<br />
<br />
void loop() {<br />
  // Turn ON outputs from 1 to 64 (LOW)<br />
  for (int channel = 0; channel &lt; 64; channel++) {<br />
    int chipIndex = channel / 16;       &nbsp;&nbsp;// Which PCF8575 (0 to 3)<br />
    int pinIndex = channel % 16;          // Which pin on that PCF8575 (0 to 15)<br />
    pcfArray[chipIndex]-&gt;write(pinIndex, LOW); // Turn ON the output<br />
    delay(DELAY_TIME);<br />
  }<br />
<br />
  // Turn OFF outputs from 64 to 1 (HIGH)<br />
  for (int channel = 63; channel &gt;= 0; channel--) {<br />
    int chipIndex = channel / 16;<br />
    int pinIndex = channel % 16;<br />
    pcfArray[chipIndex]-&gt;write(pinIndex, HIGH); // Turn OFF the output<br />
    delay(DELAY_TIME);<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=7524" target="_blank" title="">1-output.zip</a> (Size: 1.03 KB / Downloads: 444)
<!-- 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=7525" target="_blank" title="">1-output.ino.merged.zip</a> (Size: 192.12 KB / Downloads: 424)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[T64M ESPHome yaml for home assistant]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7997</link>
			<pubDate>Sun, 20 Apr 2025 15:32:49 +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=7997</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 program reads 8 input states from a PCF8575 I/O expander and <br />
 * controls a corresponding 8-channel relay module. When an input pin <br />
 * is LOW, the corresponding relay is turned ON (LOW means ON for the relay).<br />
 *<br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * - PCF8575 I2C Address: 0x24<br />
 */<br />
<br />
#include &lt;Wire.h&gt;<br />
#include &lt;PCF8575.h&gt;<br />
<br />
// I2C pins<br />
#define SDA 8<br />
#define SCL 18<br />
<br />
// PCF8575 I2C address<br />
#define INPUT_I2C_ADDRESS 0x24 &nbsp;&nbsp;<br />
<br />
// Create PCF8575 object<br />
PCF8575 pcf8575_IN(INPUT_I2C_ADDRESS);<br />
<br />
void setup() {<br />
  // Initialize I2C communication<br />
  Wire.begin(SDA, SCL);<br />
<br />
  // Initialize serial communication<br />
  Serial.begin(115200);<br />
  <br />
  // Initialize PCF8575<br />
  pcf8575_IN.begin();<br />
<br />
  // Turn off all relays first (assuming LOW activates the relay)<br />
  for (int i = 8; i &lt; 16; i++) {<br />
    pcf8575_IN.write(i, HIGH);  // Set to HIGH to turn off the relay<br />
  }<br />
<br />
  Serial.println("System started: Input state controlling 8 relays");<br />
}<br />
<br />
void loop() {<br />
  // Read 16-bit state from PCF8575<br />
  uint16_t inputState = pcf8575_IN.read16(); <br />
<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    bool state = bitRead(inputState, i); // Read digital input state<br />
<br />
    Serial.print("DI");<br />
    Serial.print(i + 1);<br />
    Serial.print(" State: ");<br />
    Serial.println(state ? "HIGH" : "LOW");<br />
<br />
    // Control relay (LOW activates the relay)<br />
    pcf8575_IN.write(8 + i, state ? HIGH : LOW);<br />
  }<br />
<br />
  Serial.println("---------------------");<br />
  delay(500);<br />
}</code></div></div> yaml download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7523" target="_blank" title="">T64M-HA.txt</a> (Size: 23.77 KB / Downloads: 382)
<!-- 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 program reads 8 input states from a PCF8575 I/O expander and <br />
 * controls a corresponding 8-channel relay module. When an input pin <br />
 * is LOW, the corresponding relay is turned ON (LOW means ON for the relay).<br />
 *<br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * - PCF8575 I2C Address: 0x24<br />
 */<br />
<br />
#include &lt;Wire.h&gt;<br />
#include &lt;PCF8575.h&gt;<br />
<br />
// I2C pins<br />
#define SDA 8<br />
#define SCL 18<br />
<br />
// PCF8575 I2C address<br />
#define INPUT_I2C_ADDRESS 0x24 &nbsp;&nbsp;<br />
<br />
// Create PCF8575 object<br />
PCF8575 pcf8575_IN(INPUT_I2C_ADDRESS);<br />
<br />
void setup() {<br />
  // Initialize I2C communication<br />
  Wire.begin(SDA, SCL);<br />
<br />
  // Initialize serial communication<br />
  Serial.begin(115200);<br />
  <br />
  // Initialize PCF8575<br />
  pcf8575_IN.begin();<br />
<br />
  // Turn off all relays first (assuming LOW activates the relay)<br />
  for (int i = 8; i &lt; 16; i++) {<br />
    pcf8575_IN.write(i, HIGH);  // Set to HIGH to turn off the relay<br />
  }<br />
<br />
  Serial.println("System started: Input state controlling 8 relays");<br />
}<br />
<br />
void loop() {<br />
  // Read 16-bit state from PCF8575<br />
  uint16_t inputState = pcf8575_IN.read16(); <br />
<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    bool state = bitRead(inputState, i); // Read digital input state<br />
<br />
    Serial.print("DI");<br />
    Serial.print(i + 1);<br />
    Serial.print(" State: ");<br />
    Serial.println(state ? "HIGH" : "LOW");<br />
<br />
    // Control relay (LOW activates the relay)<br />
    pcf8575_IN.write(8 + i, state ? HIGH : LOW);<br />
  }<br />
<br />
  Serial.println("---------------------");<br />
  delay(500);<br />
}</code></div></div> yaml download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=7523" target="_blank" title="">T64M-HA.txt</a> (Size: 23.77 KB / Downloads: 382)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[T64M ESP32-S3 IO pins define]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7996</link>
			<pubDate>Sun, 20 Apr 2025 15:30:16 +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=7996</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>analog A1 (0-5v): GPIO7<br />
analog A2 (0-5v): GPIO6<br />
analog A3 (4-20mA): GPIO5<br />
analog A4 (4-20mA): GPIO4<br />
<br />
-----------------<br />
IIC Bus-1:<br />
<br />
SDA:GPIO48<br />
SCL:GPIO47<br />
<br />
PCF8575:(output1-16): i2c address:0x25<br />
PCF8575:(output17-32): i2c address:0x24<br />
PCF8575:(output33-48): i2c address:0x21<br />
PCF8575:(output49-64): i2c address:0x20<br />
<br />
24C02 EPROM i2c address: 0x50<br />
<br />
------------------<br />
<br />
IIC Bus-2:<br />
<br />
SDA:GPIO12<br />
SCL:GPIO11<br />
<br />
PCF8575:(input1-16): i2c address:0x25<br />
PCF8575:(input17-32): i2c address:0x24<br />
PCF8575:(input33-48): i2c address:0x21<br />
PCF8575:(input49-64): i2c address:0x20<br />
<br />
<br />
<br />
-----------------<br />
<br />
1-wire (pull-up resistance on PCB): <br />
GPIO15<br />
GPIO16<br />
GPIO17<br />
GPIO18<br />
<br />
free GPIO:<br />
GPIO8<br />
GPIO9<br />
GPIO10<br />
<br />
-----------------<br />
<br />
Ethernet (W5500) I/O define:<br />
<br />
clk_pin: GPIO42<br />
mosi_pin: GPIO43<br />
miso_pin: GPIO44<br />
cs_pin: GPIO41<br />
<br />
interrupt_pin: GPIO2<br />
reset_pin: GPIO1<br />
<br />
--------------------<br />
RS485: <br />
RXD:GPIO21<br />
TXD:GPIO13<br />
EN:GPIO14</code></div></div>]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>analog A1 (0-5v): GPIO7<br />
analog A2 (0-5v): GPIO6<br />
analog A3 (4-20mA): GPIO5<br />
analog A4 (4-20mA): GPIO4<br />
<br />
-----------------<br />
IIC Bus-1:<br />
<br />
SDA:GPIO48<br />
SCL:GPIO47<br />
<br />
PCF8575:(output1-16): i2c address:0x25<br />
PCF8575:(output17-32): i2c address:0x24<br />
PCF8575:(output33-48): i2c address:0x21<br />
PCF8575:(output49-64): i2c address:0x20<br />
<br />
24C02 EPROM i2c address: 0x50<br />
<br />
------------------<br />
<br />
IIC Bus-2:<br />
<br />
SDA:GPIO12<br />
SCL:GPIO11<br />
<br />
PCF8575:(input1-16): i2c address:0x25<br />
PCF8575:(input17-32): i2c address:0x24<br />
PCF8575:(input33-48): i2c address:0x21<br />
PCF8575:(input49-64): i2c address:0x20<br />
<br />
<br />
<br />
-----------------<br />
<br />
1-wire (pull-up resistance on PCB): <br />
GPIO15<br />
GPIO16<br />
GPIO17<br />
GPIO18<br />
<br />
free GPIO:<br />
GPIO8<br />
GPIO9<br />
GPIO10<br />
<br />
-----------------<br />
<br />
Ethernet (W5500) I/O define:<br />
<br />
clk_pin: GPIO42<br />
mosi_pin: GPIO43<br />
miso_pin: GPIO44<br />
cs_pin: GPIO41<br />
<br />
interrupt_pin: GPIO2<br />
reset_pin: GPIO1<br />
<br />
--------------------<br />
RS485: <br />
RXD:GPIO21<br />
TXD:GPIO13<br />
EN:GPIO14</code></div></div>]]></content:encoded>
		</item>
	</channel>
</rss>