Working on my first real Arduino project.

I opened my code in the Arduino IDE and hit build and I get errors "not declared in the scope" on every single call to the Arduino library. For instance, digitalWrite, digitalRead, INPUT, OUTPUT, etc.

I open other projects with my Arduino IDE and they build fine, so it's clearly the code in this project. I've restarted. No change.


  • 5
    If it's "clearly" the code in the project them maybe it would be a good idea to show us that code?
    – Majenko
    Mar 17, 2021 at 13:58

1 Answer 1


Still not sure what the problem was, but I included Arduino.h and everything worked. This is a hack, but an effective one. If someone else knows what I did wrong, let me know.

  • It would have been better to develop the question into something where the answer followed from it. Given your answer, it seems likely that you were not using an .ino (or .pde) extension. Something that would have revealed itself if you'd put verbose output from the compilation stage. You should do that in future questions, along with the code, etc.
    – timemage
    Mar 24, 2021 at 13:20
  • No, was using an ino. The only posting of code would have been my entire project, which is not small. Since the code belongs to my client, I have concerns about doing that. I would love help, but the price is a bit high in this case and I'll have to settle for a hack workaround.
    – Thom
    Mar 25, 2021 at 11:24
  • I'm not going to down-vote this, but for me, what you're describing as an answer would have to be demonstrated to be believed. If you have an .ino file but the code you're actually talking about is in a non-.ino file, e.g. header, then the answer makes sense, but this fact should be mentioned somewhere. The Arduino build process does add this #include to your .ino files, originally called WProgram.h since Wiring, before "Arduino" even existed.
    – timemage
    Mar 25, 2021 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.