What is my mistake?too few arguments to function 'String SendHTML(uint8_t, uint8

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

/* Put your SSID & Password */
const char* ssid = "HST23A 2,4G";  // Enter SSID here
const char* password = "Ak738596!";  //Enter Password here

/* Put IP Address details */
IPAddress local_ip(192,168,1,1);
IPAddress gateway(192,168,1,1);
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

uint8_t LED1pin = D0;
bool LED1status = LOW;

uint8_t LED2pin = D1;
bool LED2status = LOW;

uint8_t LED3pin = D2;
bool LED3status = LOW;

void setup() {
  pinMode(LED1pin, OUTPUT);
  pinMode(LED2pin, OUTPUT);
  pinMode(LED3pin, OUTPUT);
  WiFi.softAP(ssid, password);
  WiFi.softAPConfig(local_ip, gateway, subnet);
  server.on("/", handle_OnConnect);
  server.on("/led1on", handle_led1on);
  server.on("/led1off", handle_led1off);
  server.on("/led2on", handle_led2on);
  server.on("/led2off", handle_led2off);
  server.on("/led3on", handle_led3on);
  server.on("/led3off", handle_led3off);
  Serial.println("HTTP server started");
void loop() {
  {digitalWrite(LED1pin, HIGH);}
  {digitalWrite(LED1pin, LOW);}
  {digitalWrite(LED2pin, HIGH);}
  {digitalWrite(LED2pin, LOW);}

  {digitalWrite(LED3pin, HIGH);}
  {digitalWrite(LED3pin, LOW);}

void handle_OnConnect() {
  LED1status = LOW;
  LED2status = LOW;
  LED3status = LOW;
  Serial.println("GPIO7 Status: OFF | GPIO6 Status: OFF | GPIO5 Status: OFF");
  server.send(200, "text/html", SendHTML(LED3status,LED2status,LED1status)); 

void handle_led3on() {
  LED2status = HIGH;
  Serial.println("GPIO5 Status: ON");
  server.send(200, "text/html", SendHTML(true,LED3status)); 

void handle_led3off() {
  LED2status = LOW;
  Serial.println("GPIO5 Status: OFF");
  server.send(200, "text/html", SendHTML(false,LED3status)); 

void handle_led1on() {
  LED1status = HIGH;
  Serial.println("GPIO7 Status: ON");
  server.send(200, "text/html", SendHTML(true,LED2status)); 

void handle_led1off() {
  LED1status = LOW;
  Serial.println("GPIO7 Status: OFF");
  server.send(200, "text/html", SendHTML(false,LED2status)); 

void handle_led2on() {
  LED2status = HIGH;
  Serial.println("GPIO6 Status: ON");
  server.send(200, "text/html", SendHTML(true,LED1status)); 

void handle_led2off() {
  LED2status = LOW;
  Serial.println("GPIO6 Status: OFF");
  server.send(200, "text/html", SendHTML(false,LED1status)); 

void handle_NotFound(){
  server.send(404, "text/plain", "Not found");

String SendHTML(uint8_t led1stat, uint8_t led2stat, uint8_t led3stat){
  String ptr = "<!DOCTYPE html> <html>\n";
  ptr +="<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">\n";
  ptr +="<title>LED Control</title>\n";
  ptr +="<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n";
  ptr +="body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;} h3 {color: #444444;margin-bottom: 50px;}\n";
  ptr +=".button {display: block;width: 80px;background-color: #1abc9c;border: none;color: white;padding: 13px 30px;text-decoration: none;font-size: 25px;margin: 0px auto 35px;cursor: pointer;border-radius: 4px;}\n";
  ptr +=".button-on {background-color: #1abc9c;}\n";
  ptr +=".button-on:active {background-color: #16a085;}\n";
  ptr +=".button-off {background-color: #34495e;}\n";
  ptr +=".button-off:active {background-color: #2c3e50;}\n";
  ptr +="p {font-size: 14px;color: #888;margin-bottom: 10px;}\n";
  ptr +="</style>\n";
  ptr +="</head>\n";
  ptr +="<body>\n";
  ptr +="<h1>ESP8266 Web Server</h1>\n";
  ptr +="<h3>Using Access Point(AP) Mode</h3>\n";
  {ptr +="<p>LED1 Status: ON</p><a class=\"button button-off\" href=\"/led1off\">OFF</a>\n";}
  {ptr +="<p>LED1 Status: OFF</p><a class=\"button button-on\" href=\"/led1on\">ON</a>\n";}

  {ptr +="<p>LED2 Status: ON</p><a class=\"button button-off\" href=\"/led2off\">OFF</a>\n";}
  {ptr +="<p>LED2 Status: OFF</p><a class=\"button button-on\" href=\"/led2on\">ON</a>\n";}

  {ptr +="<p>LED3 Status: ON</p><a class=\"button button-off\" href=\"/led3off\">OFF</a>\n";}
  {ptr +="<p>LED3 Status: OFF</p><a class=\"button button-on\" href=\"/led3on\">ON</a>\n";}

  ptr +="</body>\n";
  ptr +="</html>\n";
  return ptr;

The Programm says that I have too few arguments. can you help me to find the error?
String SendHTML(uint8_t led1stat, uint8_t led2stat, uint8_t led3stat){
exit status 1
too few arguments to function ‘String SendHTML(uint8_t, uint8_t, uint8_t)’

You defined your SendHTML() function as taking three arguments but when you call it you only pass two arguments. That's "too few arguments to function 'String SendHTML(uint8_t, uint8_t, uint8_t)'"

void handle_led3on() {
  LED2status = HIGH;
  Serial.println("GPIO5 Status: ON");
  server.send(200, "text/html", SendHTML(true,LED3status));    <<== !!

void handle_led3off() {
  LED2status = LOW;
  Serial.println("GPIO5 Status: OFF");
  server.send(200, "text/html", SendHTML(false,LED3status));     <<== !!


yeah I know that there is something wrong with that but how can I do it that it takes tree arguments?

yeah I know that there is something wrong with that but how can I do it that it takes tree arguments?

Since the SendHTML() function is defined and implemented in your code, one would think that you know how to call it.

Give it what it wants: three arguments.

oh man ... but where? does this isn't three arguments?

String SendHTML(uint8_t led1stat,uint8_t led2stat,uint8_t led3stat)

Search your code for SendHTML. Most of the calls in there only supply two arguments.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.