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:
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.