I am having trouble interpreting the examples and the instructions for this library. I have seen several versions of "SimpleTimer" however I am successfully using this version in several other sketches with single timers and no restart functions.
while testing with other program, everything works normal with USB, 9v supply, 12v adapter etc. But t=for SIMPLE TIMER program, it is not. May be it has a new library and the fact that i have to include a new line" #include .?????
simple timer.h library download
Download File
https://lomogd.com/2xwfch
I thought I would try the code in Reply #10 just for fun. I didn't have the SimpleTimer library and it became too much trouble to install it so I rewrote the code using millis() to do the timing. I don't really see any advantage adding 400 lines of library code.
Hi Mike,
Well, I was right to think this ida has not occurred to anyone else.
I would like to think that my library is easier to use - but then it is for me, as I know it ;)
Also, I use callbacks rather than having lots of tests in the loop function, which IMHO is a cooler way of doing it.
BTW - I like your FSM description on your blog
The maximum delay problem isn't with the Timer library. The compiler treats integer literals as 16-bit signed integers unless otherwise specified, making the largest number 32767. For a delay of 5 minutes, try using 5L*60L*1000L to force a long. Source: -bin/yabb2/YaBB.pl?num=1200706295/all
Simon - great library, but I am having a similar problem to Per, except it's the "every" function, which wont work with a value greater than 30,000 (32,767, probably!).
I looked in the .cpp files and the .h files, but didn't understand them. Can you help, please.
Hey,
I think I'm only too stupid for this, but in all of your examples you used the events in the "setup". But what, if I want to start them first later on, triggered by an event happening in the loop?
I also looked at the "Metro"-lib, and the examples there, and there the way I want the Timer to be triggered is much easier.
So, maybe I just did not understand something, but maybe you could update your examples with the case I explained.
Anyway, nice library!
Thanks :)
Hi. A very simple library that does well it's work.
BUT
I think it'a a bad thing search for "first unused int timer" and reuse it .
Stop function doesn't work well in this way.
Sometimes I need to stop a timer, in a stupid manner ( it could be active or not ... ) . Whith "dynamic" timers numeration I risk to stop a wrong timer ( first time I used this library it happened, and I spent a lot of time before understand that reading the source ).
I think ( I did ) it's better to bind with the function " t.oscillate( Timer_n .... ) " the identifier of the timer.
Also I think a "delayed start" could be a good addition, without using a lot of "after" and functions. For example if I need to blink a led like a morse code to show an even I could do t.oscillate(delayed,stuff,x,100,4);
t.oscillate(delayed + 500,x,50,10);
Hi
Hi Dr Monk. Thanks for the library. I have been trying to switch on a relay for 15 sec and then switch it off for 15 min. I have tried various combinations of your "calls" without success. Do you have any suggestions?
You wrote that you wanted to hear from similar projects.
If have written a statemachine library that is (in my opinion) very useful.
It is found here:
It is NOT primarily a timer library but it can be used for running multiple timers as well by putting the timer action in the head function and having a timeout do a restart in the body.
Hi Dr. Monk,
What a great library. I was wondering if it is possible to adjust the duty cycle of the oscillations. I saw this was asked earlier but I couldn't find answer.
Thanks!
Hi Simon,
it would be much easier for beginners if you would correct the pulse sample, cause it does not the same as the sample with delay. To achieve the same you have to use pulseImmediate wich is not mentioned in the referenz.
That would make it easier for beginners to use and understand your great library.
Thanks
Mark
Thank you very much for the fine library which I believe it is essential!
I have a question while I am using it for implementing wall clock. It is little bit slow. I assigned it to invoke every 1 sec. After several minutes, I found my clock runs little bit lagging. Would you take a look into it? Thank you.
I downloaded the SimpleTimer library from the Arduino's library manager and navigated to Arduino Playground website for some sample code for testing - SimpleTimer - Arduino Playground. After copying the following code into the Arduino IDE:
I am new to PIO, trying to move an esp32 project that uses the hardware timer from the Arduino IDE to VS Code.
At this stage the code is a simple test that sets a watchdog timer that is reset every time a button is pressed, it will be used later as part of a UI timeout.
Using the Arduino IDE 2.1.0 on Ubuntu 22.04 it all works fine uploads and runs. I want to move my code over to VS Code 1.77.3 for the better facilities and to use github.
The timer library is needed, on the Arduino IDE it is included by #include so I can use all the timer functions such as timerAttachInterrupt etc.
When I moved over to VS Code, I need to include the library, but when I go the PIO Home then Libraries and search I do not find the library, same for esp_system. How do I install esp_system to that VS Code can use the Timer library.
I have seached extensively but not found out how to do this, any guidance will be appreciated.
I have read the "Getting Started with ESP32" from start to end. It is very good by the way. I was specifically interested in how to get the correct time using time.h
-intro/#Simple_Time
It references the SimpleTime sketch that comes with the ESP32 library in the Arduino IDE.
The example on that website is simple, which is good for the purposes of the demonstration, but that simplicity assumed that the processor could be dedicated to spending most of its time spinning its registers in the delay(ms) function. However, in most cases, the processor will have other things to do. Furthermore, calling NTP every second is a massive overkill, which if it was repeated across all processors across the world that use NTP, could overrun the servers.
alyssawrong, the SparkIntervalTimer library is not compatible with Gen3 hardware. The library is ties to the STM32Fxxx hardware timers which are not available on Gen3. Currently, only one hardware timer is free on Gen3 devices. I am waiting for some decisions for the DeviceOS that might free up another timer before I write or adapt the SparkIntervalTimer library for mesh devices.
With that out of the way, you need to point nvcc at the place where cutil.h is located (should be something like C/common/inc inside the SDK, and you will need to point the linker at the place where the cutil library is located (should be something like C/lib inside the SDK).
In ISO C, time_t can be either an integer or a floating-pointtype, and the meaning of time_t values is not specified. Theonly things a strictly conforming program can do with time_tvalues are: pass them to difftime to get the elapsed timebetween two simple calendar times (see Calculating Elapsed Time),and pass them to the functions that convert them to broken-down time(see Broken-down Time).
struct timeval is an older type for representing a simplecalendar time, or an elapsed time, with sub-second resolution. It isalmost the same as struct timespec, but provides onlymicrosecond resolution. It is declared in sys/time.h and hasthe following members:
The timer driver allows you to measure elapsed time with simple and portable APIs.This driver does not have PWM or capture functionalities. These functionalities are addressed in both the capture and PWM driver.
Runners often use stopwatch timers to record how long it takes them to complete a lap around a course or finish an entire run. You can use a stopwatch to track how long it takes to complete any task, such as coding a simple program.
The Arduino SFEMP3Shield Library is a driver for VSLI's VS10xx, implemented as a Slave co-processor to audio decode streams of Ogg Vorbis/MP3/AAC/WMA/FLAC/WAVMIDI formats, across the SPI bus of the Arduino, along with mixing input signals. Principally this library is developed for the VS1053, where it may be compatible with other VS10xx's
As mentioned the initial and principal support of this library is with Arduino 328 UNO/Duemilanove with a SparkFun MP3 Player Shield. Although various other boards and shields may be implemented by customing the SFEMP3ShieldConfig.h file.
The available CPU can be increased by either or both increasing the speed of the SPI and or the Arduino F_CPU. Where the Speed of the SPI is individually maintained by both this driver and SdFatLib. As not to or be interfered with each other and or other libraries using the same SPI bus. The SdCard can be increased from SPI_HALF_SPEED to SPI_FULL_SPEED argument in the SD.begin. Where this library will set the Read and Write speeds to the VSdsp correspondingly, based on F_CPU of the Arduino.
vs_plg_to_bin.pl is a perl script, that is provided in this library to run on your PC, to read and digest the .plg files converting them to raw binary as to be read by SFEMP3Shield::VSLoadUserCode() from the SdCard. Allowing updates to the VSDsp into its volatile memory after each reset. These updates may be custom features or accumulated patches.
Error Codes typically are returned from this Library's object's in place of Serial.print messages. As to both save Flash space and Serial devices may not always be present. Where it becomes the responsibility of the calling sketch of the library's object to appropiately react or display corresponding messages.
f5d0e4f075