hello guys, i'm pretty new at arduino programming and i want to create a function that needs to be done with embedded or any other way that you guys could tell me, here is the code, the problem is that after i upload the program to the arduino it continually reads both ifs even thought the second one is embedded in the else function
majenko:
If you want more than one line to be controlled by an if, you must enclose them in { and }:
I would go so far as to say that conditional code paths should always be enclosed by braces to turn them into a compound statement, even when they only contain a single statement. It avoids any maintenance-induced errors and also avoids any doubt about whether subsequent statements were intended to be conditional or not.
Indenting has no effect in C/C++, if is the braces that determine how the code is interpreted. Indenting is just used by programmers to help make code more readable.