Notifications
Clear all

ESP32 timer clarification

4 Posts
3 Users
0 Likes
869 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6964
Topic starter  

I have a need for an alarm. Once it is going, I may need to set another alarm on the SAME timer, basically determine if the amount of time left on the original timer is more than what I now want then do nothing else (and this is the question) what is the sequence of commands to replace the existing alarm and add a new alarm. I can't tell the difference between TimerEnd and timerStop. Also there is also timerRestart, and timerStart

NOTE these are one shot not repeating alarms, the ISR has NO code other than a status flag to allow me to shut off a led that was lit when the timer started.

Using multiple timers doesn't change my problem much, I still need to understand the purpose of not only the above commands but a couple more now to deal with multiples.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Quote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

I don't have any experience with ESP32... yet.  I use timers extensively on the ESP8266, JavaScript and Windows programming.   So... I Google ESP32 with some of the timer functions you mentioned above and apparently many people have trouble with them.  It must be handled differently on an ESP32 than other architectures.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6964
Topic starter  

@inq Yes, I found some info as well, but it was a while ago and at least a few problems have been fixed and there may be workarounds. Part of the problem today was coming up with a test sketch, now that I have the real sketch and hardware done, I can test with the real code. From what I read today I may just delete the timer and re-create it as long as the call to get remaining time works. Worst case I can save a millis() of the start of each timer. I have 3 buttons that trigger 3 different timeouts, that is the reason for this. Tomorrow will be better.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@inq Yes, I found some info as well, but it was a while ago and at least a few problems have been fixed and there may be workarounds. Part of the problem today was coming up with a test sketch, now that I have the real sketch and hardware done, I can test with the real code. From what I read today I may just delete the timer and re-create it as long as the call to get remaining time works. Worst case I can save a millis() of the start of each timer. I have 3 buttons that trigger 3 different timeouts, that is the reason for this. Tomorrow will be better.

You never responded to my last message on timers:

https://forum.dronebotworkshop.com/help-wanted/using-a-pin-to-signal-another-pin/paged/3/#post-27653

...although not ESP32 related, the theoretical tutorial may help.


   
ReplyQuote