Hello.
Problem is to detect character. Web server is responding to "client.print(String("GET ")" with 010 where 2 first digits are relays and last one is to enter OTP mode. This works.
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
line = client.readStringUntil('\r'); // String
Here i can do a " Serial.println(line); " and it will respond with 010
Then detect if first character is 0 or 1
// Relay 1
if (line.charAt(1) == "1") { do something...
Responds with "error: ISO C++ forbids comparison between pointer and integer [-fpermissive]"
or
if (line.substring(1,1) == "1") { do something...
Compiles OK, Serial responds with nothing
the first one is a cString (a null terminated array of characters - first byte is the ASCII code of the letter a and then a 0 byte ) and the latter is just one byte in memory initialized with the ASCII code of the lettre a
when you have a cString in your code, it's actually represented by the pointer to the start of the memory array so the error you get when you do
if ([color=blue]line.charAt(1)[/color] == [color=red]"1"[/color]) { do something...}
error: ISO C++ forbids [color=red]comparison between pointer and integer[/color] [-fpermissive]
is because "1" is actually a pointer to the start of the array whereas [color=blue]line.charAt(1)[/color] returns just a character (an integral number)... you need to compare characters with characters