Im working with node mcu ESP 8266 and trying to make it a webserver but keep encountering this problem.
#include<ESP8266WiFi.h>
WiFiClient client;
WiFiServer server(80);
void setup()
{
Serial.begin(9600);
WiFi.begin("network","password");
while(WiFi.status()!= WL_CONNECTED)
{
delay(200);
Serial.print("...");
}
Serial.println("NodeMCu is connected");
server.begin();
}
void loop()
{
client = server.available();
if(client==1)
{
String request= client.readStringUntil("\n");
Serial.println(request);
}
}
```
I'm getting this error :error: invalid conversion from 'const char*' to 'char' [-fpermissive]
24 | String request= client.readStringUntil("\n");
| ^~~~
| |
| const char*
client.readStringUntil("\n")
. The double quotes make the\n
into a c-string (const char *
), but it expects a single character (char
). You can correct this by changing"\n"
into (single quoted)'\n'
, which makes it into a single character.