ISO C++ forbids comparison between pointer and integer [-fpermissive]

Dear friends,

I´m creating a function which can rotate a 28BYJ-48 motor, using ESP32.
However, I have the error message shown in the subject.
I've already found some similar topics, but the presented solutions does not match my problem.

I want to create an array according to the arguments sent to the funcion:

void operacao(char sentido, char eixo, int passos) {

int velOper = 15;

if ((sentido == "CW") && (eixo == "H")) {
int giraMotor[] = {19, 21, 22, 23};
}

When trying to compile, it returns the error.

Any suggestion?
Thank you very much!

Any suggestion?

Post a complete sketch

Please follow the advice on posting code given in posting code

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

void operacao(char sentido, char eixo, int passos) {

    int velOper = 15;

    if ((sentido == 'C') && (eixo == 'H')) {
        int giraMotor[] = {19, 21, 22, 23};
    }

You are trying to compare a string ("CW") to a single character ('C').

Use the approach I posted, or make up constants called CW and H

Sorry, the rest of the code is fine, I thought it would be easier to analyze if I only post the problem part.

Thank you for the tip. I will try to understand it and fix accordingly, despite I don´t know C++.

tamer79:
Sorry, the rest of the code is fine, I thought it would be easier to analyze if I only post the problem part.

http://snippets-r-us.com/
For that reason there are pinned topic's in bold at the top of each board. But people with questions seem to think those don't apply to them...

despite I don´t know C++.

Learning is a process :slight_smile:

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