Error on String/char comparison - 'forbids comparison between pointer and integer'

Hi,
I'm using an ESP8266 to grab some website data and light some lights.
The website provides a string of bools (ie, "10001").
The sketch I'm using is based on the default HTTP client which reads the data into a String. All well so far.

I'm struggling to then convert a digit into a boolean.

I have a String called 'payload'. The first five digits are 1 or 0.
I have tried if (payload.charAt(0) == "1") but I get an error saying that I'm comparing a pointer to an integer.

I've tried dumping the character into a char:
char bl = payload.charAt(0);
and then tried the comparison with "1" but I get the same error, so I tried bl[0]=="1" but get 'invalid types 'char[int]' for array subscript'.

I don't understand what I'm doing wrong.

TL;DR I want a String of five 1s and 0s (eg, "10001") to be parsed as five booleans.

try single quotes here: "1"

Thank you!

That was frustratingly simple.

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