Arduino error "was not declared in this scope" - that's why
This practical tip shows you what you can do if you receive the "was not declared in this scope" error on the Arduino IDE.
Arduino error: "was not declared in this scope"
The "was not declared in this scope" error occurs on the Arduino if you assign a value to a variable without having previously declared it.
- For example, add the command "a = 6;" added to the program without first "int a;" Having written, the error is output.
- You also cannot use methods from external libraries if you have not previously imported them with "#include ...".
- To determine whether you forgot to import a library or to declare a variable, you can look at the compiler's output log. You can find it at the bottom of the screen. There you will recognize the forgotten declaration and you can simply add it. The error then disappeared.
In the next article, you will learn how to send an SMS with the Arduino.