Go Down

Topic: Lack of Timer support for Arduino (Read 671 times) previous topic - next topic

cappy2112

Nov 16, 2011, 09:09 pm Last Edit: Nov 16, 2011, 09:17 pm by cappy2112 Reason: 1
Would someone explain why there is no support for timers in the core Arduino language?
http://arduino.cc/en/Reference/HomePage

There is an external library here
http://www.arduino.cc/playground/Main/MsTimer2

why isn't this included with the Arduino software?


Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?

Quote
"Install it on {arduino-path}/hardware/libraries/ "


All Arduino libraries on a Windows system are under
\Program Files\Arduino\libraries\

Quote
not \Program Files\Arduino\hardware\libraries
[/color]




Thanks

Onions

Timers are an internal piece of hardware found in side the AVR. It is probably assumed that those users capable of using timers properly will not be wanting to use a library like timer2 for it. There are many libraries created that are not included in the arduino software, generally because they are less useful or commonly used. On the other hand, timer2 does provide some very useful extra functions for users unable to use the timers...

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?
Quote

"Install it on {arduino-path}/hardware/libraries/ "


All Arduino libraries on a Windows system are under
\Program Files\Arduino\libraries\

Quote
not \Program Files\Arduino\hardware\libraries


It would appear so. You are able to edit the page, so why not correct it?

Onions.
My website: http://www.harryrabbit.co.uk/electronics/home.html Up and running now! (Feel free to look round!) :D

PaulS

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?

Maybe. Maybe not.

Quote
All Arduino libraries on a Windows system are under

Not on my installation of Arduino.

The libraries that were delivered with the Arduino used to be in .\Arduino-xxxx\hardware\libraries. Not all the libraries were specific to hardware, to the library location changed.

Quote
Would someone explain why there is no support for timers in the core Arduino language?

There is plenty of support for all the timers on the Duemilanove/UNO type Arduinos. They each have dedicated functionality, and are not always available for your use. The tone function, for instance, needs a timer. The servo library needs some timers. The PWM function uses a timer for two pins. There being a limited number of timers, there may not be one available to you.

Anything you can do with a timer, you can do without a timer, of the Arduino isn't overworked. If it is, having a timer interrupt it may not be a great idea.

Knowing what YOU want to do with a timer would be useful in order to suggest an approach.

cappy2112


It would appear so. You are able to edit the page, so why not correct it?

Onions.


I wanted verification first.

When I tried the Timer2 example on the web page, the compiler cannot find <MsTimer2.h>.
I've tries this with the timer2 library in the specified location, as well as under \Program Files\Arduino\libraries\

PaulS

Is it safe to assume that you actually downloaded the MsTimer2 library?

If you did, did you restart the IDE after installing the library?

retrolefty

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?


I've used the MsTimer2 library for several of my projects, and I don't recall having any problems installing or using it. Here is where it is stored on my Windows XP system:

Quote


C:\Documents and Settings\Primary Windows User\My Documents\Arduino\libraries

17 Folders:

Bounce
Button
DS1307
EasyTransfer
Flash
FreqCount
FreqMeasure
MsTimer2
NewSoftSerial
Playtune
PS2Keyboard
SoftEasyTransfer
Streaming
String
Tone
WString
__MACOSX


0 Files:

cappy2112


Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?


I've used the MsTimer2 library for several of my projects, and I don't recall having any problems installing or using it. Here is where it is stored on my Windows XP system:

Quote


C:\Documents and Settings\Primary Windows User\My Documents\Arduino\libraries

17 Folders:

Bounce
Button
DS1307
EasyTransfer
Flash
FreqCount
FreqMeasure
MsTimer2
NewSoftSerial
Playtune
PS2Keyboard
SoftEasyTransfer
Streaming
String
Tone
WString
__MACOSX


0 Files:



How strange. This is not the default location- yet you don't seem to be having any problems using the IDE.
How did you get the IDE to find the libs there, instead of the default location?

I've just installed 0023 on Windows XP, and the default lib path is here (And is the same for 0022)
\Program Files\Arduino\libraries\


PeterH

#7
Nov 17, 2011, 12:39 am Last Edit: Nov 17, 2011, 01:28 am by PeterH Reason: 1
I've noticed the library location being described differently in difrferent publications.

On my installation, done a couple of days ago (because I'm a noob), the standard libraries are all under C:\Program Files\(my installation directory)\libraries and that's where I've put the additional libraries I'm using; they all seem to work fine. My sketches were automatically saved under My Documents/Arduino but I don't have a library directory under there. Other people do seem to have libraries under there, though.

Is it possible the Arduino is clever enough to look in both locations?

Edited to add:

Yes, it is. I just created a library directory under My Documents/Arduino and put a new library in there, and it appears under Sketch->Import Library.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up