Timer1 was not declared in this scope

So you get the error message “Timer1 was not declared in this scope”  when you are compiling a program for your Arduino and you dont know what the problem is. You copied a program from the internet and everyone says it works, but  you can’t seem to get it to work.
You check the code and yes, the ‘TimerOne’ library is declared, and it can be found, so why doesnt it work?
Well, there could be several reasons, but it could well be that your TimerOne library is out of date:
here is what you do:

Make sure your TimerOne.h file contains:
extern TimerOne Timer1;

and that your TimerOne.cpp file contains:
TimerOne Timer1;

If not, update the TimerOne library. A good source would be here.

Also, if you are using a Teensy, it seems that for some time the TimerOne library wasn’t ported for the Teensy, but that seems to be fixed  now as well.

Advertisement

7 thoughts on “Timer1 was not declared in this scope”

  1. hi. Im.stumped. i followed ur instructions and I am still getting the error timer1 was not declared. ? any ideas. i downloaded and unzipped into libraries and its there
    what now
    your help would be greatly appreciated

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: