[Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - KinCony Support - 08-24-2022
[Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code
KC868-A16_Web_Server.zip (Size: 464.75 KB / Downloads: 1,171)
Code: /***********************************************************
* Create Your own WebServer for KC868-A16 Smart Controller*
* https://www.kincony.com **
***********************************************************/
// Load Wi-Fi library
#include <WiFi.h>
#include "PCF8574.h"
#include <WiFiManager.h>
#define TRIGGER_PIN 0 // reset wifi button
WiFiManager wm;
int timeout =20; // seconds to run for
// Replace with your network credentials
/*******config the WIFI by phone*****************/
/* const char* ssid = "xxx"; //your router's ssid
const char* password = "yyy"; //your router's password*/
/*******************************************************/
// Set web server port number to 80
WiFiServer server(80);
// Variable to store the HTTP request
String header;
// Current time
unsigned long currentTime = millis();
// Previous time
unsigned long previousTime = 0;
// Define timeout time in milliseconds (example: 2000ms = 2s)
const long timeoutTime = 2000;
int flag_read_di=0;
TwoWire I2Cone = TwoWire(0);
TwoWire I2Ctwo = TwoWire(1);
/*******Check the I2C address **********/
/********If your board was purchased earlier, use an older I2C**/
/********OLD A16 Board I2C address */
/*
PCF8574 pcf8574_I1(&I2Cone,0x22,4,5);
PCF8574 pcf8574_I2(&I2Cone,0x21,4,5);
PCF8574 pcf8574_R1(&I2Cone,0x24,4,5);
PCF8574 pcf8574_R2(&I2Cone,0x25,4,5);*/
// Set A16 digital input i2c address
/********NEW A16 Board I2C address */
PCF8574 pcf8574_I1(&I2Cone,0x3A,4,5);
PCF8574 pcf8574_I2(&I2Cone,0x39,4,5);
PCF8574 pcf8574_R1(&I2Cone,0x3C,4,5);
PCF8574 pcf8574_R2(&I2Cone,0x3D,4,5);
String relaystate[16]={"relay1state","relay2state","relay3state","relay4state",
"relay5state","relay6state","relay7state","relay8state",
"relay9state","relay10state","relay11state","relay12state",
"relay13state","relay14state","relay15state","relay16state"
};
String relay1state = "off";// state of relay1
String relay2state = "off";// state of relay2
String relay3state = "off";// state of relay3
String relay4state = "off";// state of relay4
String relay5state = "off";// state of relay5
String relay6state = "off";// state of relay6
String relay7state = "off";// state of relay7
String relay8state = "off";// state of relay8
String relay9state = "off";// state of relay9
String relay10state = "off";// state of relay10
String relay11state = "off";// state of relay11
String relay12state = "off";// state of relay12
String relay13state = "off";// state of relay13
String relay14state = "off";// state of relay14
String relay15state = "off";// state of relay15
String relay16state = "off";// state of relay16
void setup() {
pinMode(TRIGGER_PIN, INPUT_PULLUP); // wifi reset button
Serial.begin(115200);
// Set PCF8574 pinMode to OUTPUT
for(int i=0;i<=7;i++)
{
pcf8574_R1.pinMode(i, OUTPUT);
pcf8574_R2.pinMode(i, OUTPUT);
}
pcf8574_R1.begin();
pcf8574_R2.begin();
for(int i=0;i<=7;i++)
{
pcf8574_I1.pinMode(i, INPUT);
pcf8574_I2.pinMode(i, INPUT);
}
pcf8574_I1.begin();
pcf8574_I2.begin();
for(int i=0;i<=7;i++)
{
pcf8574_R1.digitalWrite(i, HIGH);
pcf8574_R2.digitalWrite(i, HIGH);
}
WiFi.mode(WIFI_STA);
wm.setConfigPortalTimeout(timeout);
bool res;
res = wm.autoConnect("KC868-A16-AP"); // anonymous ap
if(!res) {
Serial.println("Failed to connect");
}
else {
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
}
// Print local IP address and start web server
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop(){
WiFiClient client = server.available(); // Listen for incoming clients
if (client) { // If a new client connects,
Serial.println("New Client."); // print a message out in the serial port
String currentLine = ""; // make a String to hold incoming data from the client
currentTime = millis();
previousTime = currentTime;
while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the client's connected
currentTime = millis();
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
header += c;
if (c == '\n') { // if the byte is a newline character
// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
// turns 16 relays on and off
if (header.indexOf("GET /1/on") >= 0) {relay1state = "on";pcf8574_R1.digitalWrite(P0, LOW);}
else if (header.indexOf("GET /1/off") >= 0) {relay1state = "off";pcf8574_R1.digitalWrite(P0, HIGH);}
else if (header.indexOf("GET /2/on") >= 0) {relay2state = "on";pcf8574_R1.digitalWrite(P1, LOW);}
else if (header.indexOf("GET /2/off") >= 0) {relay2state = "off";pcf8574_R1.digitalWrite(P1, HIGH);}
else if (header.indexOf("GET /3/on") >= 0) {relay3state = "on";pcf8574_R1.digitalWrite(P2, LOW);}
else if (header.indexOf("GET /3/off") >= 0) {relay3state = "off";pcf8574_R1.digitalWrite(P2, HIGH);}
else if (header.indexOf("GET /4/on") >= 0) {relay4state = "on";pcf8574_R1.digitalWrite(P3, LOW);}
else if (header.indexOf("GET /4/off") >= 0) {relay4state = "off";pcf8574_R1.digitalWrite(P3, HIGH);}
else if (header.indexOf("GET /5/on") >= 0) {relay5state = "on";pcf8574_R1.digitalWrite(P4, LOW);}
else if (header.indexOf("GET /5/off") >= 0) {relay5state = "off";pcf8574_R1.digitalWrite(P4, HIGH);}
else if (header.indexOf("GET /6/on") >= 0) {relay6state = "on";pcf8574_R1.digitalWrite(P5, LOW);}
else if (header.indexOf("GET /6/off") >= 0) {relay6state = "off";pcf8574_R1.digitalWrite(P5, HIGH);}
else if (header.indexOf("GET /7/on") >= 0) {relay7state = "on";pcf8574_R1.digitalWrite(P6, LOW);}
else if (header.indexOf("GET /7/off") >= 0) {relay7state = "off";pcf8574_R1.digitalWrite(P6, HIGH);}
else if (header.indexOf("GET /8/on") >= 0) {relay8state = "on";pcf8574_R1.digitalWrite(P7, LOW);}
else if (header.indexOf("GET /8/off") >= 0) {relay8state = "off";pcf8574_R1.digitalWrite(P7, HIGH);}
else if (header.indexOf("GET /9/on") >= 0) {relay9state = "on";pcf8574_R2.digitalWrite(P0, LOW);}
else if (header.indexOf("GET /9/off") >= 0) {relay9state = "off";pcf8574_R2.digitalWrite(P0, HIGH);}
else if (header.indexOf("GET /10/on") >= 0) {relay10state = "on";pcf8574_R2.digitalWrite(P1, LOW);}
else if (header.indexOf("GET /10/off") >= 0) {relay10state = "off";pcf8574_R2.digitalWrite(P1, HIGH);}
else if (header.indexOf("GET /11/on") >= 0) {relay11state = "on";pcf8574_R2.digitalWrite(P2, LOW);}
else if (header.indexOf("GET /11/off") >= 0) {relay11state = "off";pcf8574_R2.digitalWrite(P2, HIGH);}
else if (header.indexOf("GET /12/on") >= 0) {relay12state = "on";pcf8574_R2.digitalWrite(P3, LOW);}
else if (header.indexOf("GET /12/off") >= 0) {relay12state = "off";pcf8574_R2.digitalWrite(P3, HIGH);}
else if (header.indexOf("GET /13/on") >= 0) {relay13state = "on";pcf8574_R2.digitalWrite(P4, LOW);}
else if (header.indexOf("GET /13/off") >= 0) {relay13state = "off";pcf8574_R2.digitalWrite(P4, HIGH);}
else if (header.indexOf("GET /14/on") >= 0) {relay14state = "on";pcf8574_R2.digitalWrite(P5, LOW);}
else if (header.indexOf("GET /14/off") >= 0) {relay14state = "off";pcf8574_R2.digitalWrite(P5, HIGH);}
else if (header.indexOf("GET /15/on") >= 0) {relay15state = "on";pcf8574_R2.digitalWrite(P6, LOW);}
else if (header.indexOf("GET /15/off") >= 0) {relay15state = "off";pcf8574_R2.digitalWrite(P6, HIGH);}
else if (header.indexOf("GET /16/on") >= 0) {relay16state = "on";pcf8574_R2.digitalWrite(P7, LOW);}
else if (header.indexOf("GET /16/off") >= 0) {relay16state = "off";pcf8574_R2.digitalWrite(P7, HIGH);}
else if (header.indexOf("GET /read") >= 0) flag_read_di=1;
else if (header.indexOf("GET /all/on") >= 0)
{
relay1state = "on";// state of relay1
relay2state = "on";// state of relay2
relay3state = "on";// state of relay3
relay4state = "on";// state of relay4
relay5state = "on";// state of relay5
relay6state = "on";// state of relay6
relay7state = "on";// state of relay7
relay8state = "on";// state of relay8
relay9state = "on";// state of relay9
relay10state = "on";// state of relay10
relay11state = "on";// state of relay11
relay12state = "on";// state of relay12
relay13state = "on";// state of relay13
relay14state = "on";// state of relay14
relay15state = "on";// state of relay15
relay16state = "on";// state of relay16
for(int i=0;i<=7;i++)
{
pcf8574_R1.digitalWrite(i, LOW);
pcf8574_R2.digitalWrite(i, LOW);
}
}
else if (header.indexOf("GET /all/off") >= 0)
{
relay1state = "off";// state of relay1
relay2state = "off";// state of relay2
relay3state = "off";// state of relay3
relay4state = "off";// state of relay4
relay5state = "off";// state of relay5
relay6state = "off";// state of relay6
relay7state = "off";// state of relay7
relay8state = "off";// state of relay8
relay9state = "off";// state of relay9
relay10state = "off";// state of relay10
relay11state = "off";// state of relay11
relay12state = "off";// state of relay12
relay13state = "off";// state of relay13
relay14state = "off";// state of relay14
relay15state = "off";// state of relay15
relay16state = "off";// state of relay16
for(int i=0;i<=7;i++)
{
pcf8574_R1.digitalWrite(i, HIGH);
pcf8574_R2.digitalWrite(i, HIGH);
}
}
// Display the HTML web page
client.println("<!DOCTYPE html><html>");
client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<link rel=\"icon\" href=\"data:,\">");
// CSS to style the on/off buttons
// Feel free to change the background-color and font-size attributes to fit your preferences
client.println("<style>html { font-family: Helvetica; display: inline-block; border: 3px solid green;margin: 0px 15px;}");
client.println(".button { background-color: #195B00; border-radius: 10px;color: white; padding: 10px 40px;");
client.println("text-decoration: none; font-size: 20px; margin: 2px;text-align: center; cursor: pointer;}");
client.println(".button2 {background-color: #77878A;}</style></head>");
if (flag_read_di==1)
{
client.println(" relay1:" + relay1state + " relay2:" + relay2state + " relay3:" + relay3state + " relay4:" + relay4state + " relay5:" + relay5state + " relay6:" + relay6state + " relay7:" + relay7state + " relay8:" + relay8state + " relay9:" + relay9state + " relay10:" + relay10state + " relay11:" + relay11state + " relay12:" + relay12state + " relay13:" + relay13state + " relay14:" + relay14state + " relay15:" + relay15state + " relay16:" + relay16state);
}
else
{
// Web Page Heading
client.println("<body><h1>KC868-A16 Web Server</h1>");
// Display current state, and ON/OFF buttons for relay
//client.println("<p>relay1 - State " + relay1state + "</p>");
// If the relay is off, it displays the ON button
if (relay1state == "off") client.println("<a href=\"/1/on\"><button class=\"button\">01-OFF</button></a>"); else client.println("<a href=\"/1/off\"><button class=\"button\">01-ON </button></a>");
if (relay2state == "off") client.println("<a href=\"/2/on\"><button class=\"button\">02-OFF</button></a>"); else client.println("<a href=\"/2/off\"><button class=\"button\">02-ON </button></a>");
if (relay3state == "off") client.println("<a href=\"/3/on\"><button class=\"button\">03-OFF</button></a>"); else client.println("<a href=\"/3/off\"><button class=\"button\">03-ON </button></a>");
if (relay4state == "off") client.println("<a href=\"/4/on\"><button class=\"button\">04-OFF</button></a>"); else client.println("<a href=\"/4/off\"><button class=\"button\">04-ON </button></a>");
if (relay5state == "off") client.println("<a href=\"/5/on\"><button class=\"button\">05-OFF</button></a>"); else client.println("<a href=\"/5/off\"><button class=\"button\">05-ON </button></a>");
if (relay6state == "off") client.println("<a href=\"/6/on\"><button class=\"button\">06-OFF</button></a>"); else client.println("<a href=\"/6/off\"><button class=\"button\">06-ON </button></a>");
if (relay7state == "off") client.println("<a href=\"/7/on\"><button class=\"button\">07-OFF</button></a>"); else client.println("<a href=\"/7/off\"><button class=\"button\">07-ON </button></a>");
if (relay8state == "off") client.println("<a href=\"/8/on\"><button class=\"button\">08-OFF</button></a>"); else client.println("<a href=\"/8/off\"><button class=\"button\">08-ON </button></a>");
if (relay9state == "off") client.println("<a href=\"/9/on\"><button class=\"button\">09-OFF</button></a>"); else client.println("<a href=\"/9/off\"><button class=\"button\">09-ON </button></a>");
if (relay10state == "off") client.println("<a href=\"/10/on\"><button class=\"button\">10-OFF</button></a>"); else client.println("<a href=\"/10/off\"><button class=\"button\">10-ON</button></a>");
if (relay11state == "off") client.println("<a href=\"/11/on\"><button class=\"button\">11-OFF</button></a>"); else client.println("<a href=\"/11/off\"><button class=\"button\">11-ON</button></a>");
if (relay12state == "off") client.println("<a href=\"/12/on\"><button class=\"button\">12-OFF</button></a>"); else client.println("<a href=\"/12/off\"><button class=\"button\">12-ON</button></a>");
if (relay13state == "off") client.println("<a href=\"/13/on\"><button class=\"button\">13-OFF</button></a>"); else client.println("<a href=\"/13/off\"><button class=\"button\">13-ON</button></a>");
if (relay14state == "off") client.println("<a href=\"/14/on\"><button class=\"button\">14-OFF</button></a>"); else client.println("<a href=\"/14/off\"><button class=\"button\">14-ON</button></a>");
if (relay15state == "off") client.println("<a href=\"/15/on\"><button class=\"button\">15-OFF</button></a>"); else client.println("<a href=\"/15/off\"><button class=\"button\">15-ON</button></a>");
if (relay16state == "off") client.println("<a href=\"/16/on\"><button class=\"button\">16-OFF</button></a>"); else client.println("<a href=\"/16/off\"><button class=\"button\">16-ON</button></a>");
client.println("<a href=\"/all/on\"><button class=\"button\">All-ON</button></a>");
client.println("<a href=\"/all/off\"><button class=\"button\">All-OFF</button></a>");
}
client.println("</body></html>");
// The HTTP response ends with another blank line
client.println();
break;
} else { // if you got a newline, then clear currentLine
currentLine = "";
}
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}
}
}
// Clear the header variable
header = "";
// Close the connection
client.stop();
Serial.println("Client disconnected.");
Serial.println("");
flag_read_di=0;
}
ScanKey(); //scan key
if ( digitalRead(TRIGGER_PIN) == LOW) {wm.resetSettings();ESP.restart();}
}
void ScanKey()
{
for(int i=0;i<=7;i++)
{
if(pcf8574_I1.digitalRead(i) == LOW) //key pressed
{
delay(20);
if(pcf8574_I1.digitalRead(i) == LOW) //key pressed again
{
pcf8574_R1.digitalWrite(i,!pcf8574_R1.digitalRead(i)); // toggle relay1 state
while(pcf8574_I1.digitalRead(i) == LOW); //wait remove hand
if (pcf8574_R1.digitalRead(i) == LOW) relaystate[i+1]="on";else relaystate[i+1]="off";
}
}
}
for(int j=0;j<=7;j++)
{
if(pcf8574_I2.digitalRead(j) == LOW) //key pressed
{
delay(20);
if(pcf8574_I2.digitalRead(j) == LOW) //key pressed again
{
pcf8574_R2.digitalWrite(j,!pcf8574_R2.digitalRead(j)); // toggle relay1 state
while(pcf8574_I2.digitalRead(j) == LOW); //wait remove hand
if (pcf8574_R2.digitalRead(j) == LOW) relaystate[j+8]="on";else relaystate[j+8]="off";
}
}
}
}
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - wolli - 03-05-2025
hello
I downloaded the zip file "KC868-A16 Web_Server" when I compile it I get
the following error message
I'm still a beginner with KC868-A16 and need help
thank you in advance
/home/arduino/Downloads/KC868-A16_Web_Server/KC868-A16_Web_Server.ino:50:36: error: no matching function for call to 'PCF8574: CF8574(TwoWire*, int, int, int)'
50 | PCF8574 pcf8574_I1(&I2Cone,0x3A,4,5);
| ^
In file included from /home/arduino/Downloads/KC868-A16_Web_Server/KC868-A16_Web_Server.ino:8:
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:30:12: note: candidate: 'PCF8574: CF8574(uint8_t, TwoWire*)'
30 | explicit PCF8574(const uint8_t deviceAddress = 0x20, TwoWire *wire = &Wire);
| ^~~~~~~
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:30:12: note: candidate expects 2 arguments, 4 provided
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate: 'constexpr PCF8574: CF8574(const PCF8574&)'
27 | class PCF8574
| ^~~~~~~
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate expects 1 argument, 4 provided
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate: 'constexpr PCF8574: CF8574(PCF8574&&)'
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate expects 1 argument, 4 provided
/home/arduino/Downloads/KC868-A16_Web_Server/KC868-A16_Web_Server.ino:51:36: error: no matching function for call to 'PCF8574: CF8574(TwoWire*, int, int, int)'
51 | PCF8574 pcf8574_I2(&I2Cone,0x39,4,5);
| ^
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:30:12: note: candidate: 'PCF8574: CF8574(uint8_t, TwoWire*)'
30 | explicit PCF8574(const uint8_t deviceAddress = 0x20, TwoWire *wire = &Wire);
| ^~~~~~~
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:30:12: note: candidate expects 2 arguments, 4 provided
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate: 'constexpr PCF8574: CF8574(const PCF8574&)'
27 | class PCF8574
| ^~~~~~~
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate expects 1 argument, 4 provided
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate: 'constexpr PCF8574: CF8574(PCF8574&&)'
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:27:7: note: candidate expects 1 argument, 4 provided
/home/arduino/Downloads/KC868-A16_Web_Server/KC868-A16_Web_Server.ino:52:36: error: no matching function for call to 'PCF8574: CF8574(TwoWire*, int, int, int)'
52 | PCF8574 pcf8574_R1(&I2Cone,0x3C,4,5);
| ^
/home/arduino/Arduino/libraries/PCF8574/PCF8574.h:30:12: note: candidate: 'PCF8574: CF8574(uint8_t, TwoWire*)'
30 | explicit PCF8574(const uint8_t deviceAddress = 0x20, TwoWire *wire = &Wire);
| ^~~~~~~
and more errors
.
.
.
.
exit status 1
Compilation error: no matching function for call to 'PCF8574: CF8574(TwoWire*, int, int, int)'
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - admin - 03-06-2025
you need to install PCF8574 arduino library firstly.
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - wolli - 03-06-2025
Thank you for the quick reply
I had an older version of "PCF8574.h" installed
after reinstalling it works perfectly.
Now I wanted to test the ETH version
I have installed <WebServer_WT32_ETH01.h> 1.5.1
but unfortunately I get the following error message
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
In file included from /home/arduino/Arduino/WebServer_WT32_ETH01-main/examples/ESP32_FS_EthernetWebServer/ESP32_FS_EthernetWebServer.ino:77:
/home/arduino/Arduino/libraries/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01.h:63:4: error: #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
63 | #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
| ^~~~~
exit status 1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Compilation error: exit status 1
I need your help again
thank you
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - admin - 03-06-2025
you need config library for LAN8720
#define ETH_ADDR 0
#define ETH_POWER_PIN -1
#define ETH_MDC_PIN 23
#define ETH_MDIO_PIN 18
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - wolli - 03-07-2025
Thank you for the quick reply
I had an older version of "PCF8574.h" installed
after reinstalling it works perfectly.
Now I wanted to test the ETH version
I have installed <WebServer_WT32_ETH01.h> 1.5.1
but unfortunately I get the following error message
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
In file included from /home/arduino/Arduino/WebServer_WT32_ETH01-main/examples/ESP32_FS_EthernetWebServer/ESP32_FS_EthernetWebServer.ino:77:
/home/arduino/Arduino/libraries/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01.h:63:4: error: #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
63 | #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
| ^~~~~
exit status 1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Compilation error: exit status 1
I need your help again
thank you
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - admin - 03-07-2025
it already told you need chose ESP32 DEV board in arduino IDE.
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - wolli - 03-07-2025
Hello
I tried it with
ESP32P4 DEV Module
ESP32P2 DEV Module
ESP32C6 DEV Module
ESP32S3 DEV Module
ESP32C3 DEV Module
ESP32S2 DEV Module
ESP32 DEV Module
the error is always displayed
could it be due to outdated firmware?
if so, do you have an update guide for me?
best regards
wolli
In file included from /tmp/.arduinoIDE-unsaved202527-1777-1o0olpa.8wkj/HelloServer/HelloServer.ino:18:
/home/arduino/Arduino/libraries/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01.h:63:4: error: #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
63 | #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
| ^~~~~
exit status 1
Compilation error: exit status 1
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - admin - 03-08-2025
take a photo of your arduino IDE error screen and what board you have selected.
RE: [Arduino IDE demo source code for KC868-A16]--#09-KC868-A16_Web_server_code - wolli - 03-12-2025
Hello
I have a KC868-A16
I've recently performed an update
KCS_KC868_A16_V2.2.2.bin
The LEDs on the Ethernet interface are now lit
but I still get the error message
/****************************************************************************************************************************
WebServer.ino - Simple Arduino web server sample for Ethernet shield
For Ethernet shields using WT32_ETH01 (ESP32 + LAN8720)
WebServer_WT32_ETH01 is a library for the Ethernet LAN8720 in WT32_ETH01 to run WebServer
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
Built by Khoi Hoang https://github.com/khoih-prog/WebServer_WT32_ETH01
Licensed under MIT license
*****************************************************************************************************************************/
#define DEBUG_ETHERNET_WEBSERVER_PORT Serial
// Debug Level from 0 to 4
#define _ETHERNET_WEBSERVER_LOGLEVEL_ 3
#include <WebServer_WT32_ETH01.h>
WiFiServer server(80);
// Select the IP address according to your local network
IPAddress myIP(192, 168, 2, 232);
IPAddress myGW(192, 168, 2, 1);
IPAddress mySN(255, 255, 255, 0);
// Google DNS Server IP
IPAddress myDNS(8, 8, 8, 8);
##################################################################################################################################
In file included from /tmp/.arduinoIDE-unsaved2025212-12431-f36wql.f8x/WebServer/WebServer.ino:19:
/home/arduino/Arduino/libraries/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01.h:63:4: error: #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
63 | #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting.
| ^~~~~
exit status 1
Compilation error: exit status 1
|