I am still new to Arduino, but I 'm familiar with c++. I have a related question. I'm not sure if this should be a new topic or for another forum, but my queries concern timing. I am building something very similar. Would his code be more effective with millis? When would you use millis vs. chrono?
Thanks in advance 🖖🏾
@photo-bud is correct.
There are many excellent functions in the full C++ Standard Library, but unfortunately only a portion of those are made available.
The Arduino reference page covers what's available to you: Arduino language reference
Note:- You can also access this reference from within your IDE help menu.
Note also:- That there are other language constructs available, such as namespaces, templeates, new, delete, etc... but they are not documented in the reference.
Cheers.
@photo-bud - sorry for to include this: https://forum.arduino.cc/index.php?topic=570401.0
https://github.com/SofaPirate/Chrono
(Concurrently waiting a reply from developer(s))
I agree with @photo-bud & you - to stick with the Arduino reference when in doubt, but am I not seeing it? The 'chrono' function seems redundant, it includes 'millis' in its header file, it appears to do the same as 'millis'.
???
I will also try a few lines of C++ to experiment more regarding other constructs.
Thanks!
LAW
I agree with @photo-bud & you - to stick with the Arduino reference when in doubt, but am I not seeing it? The 'chrono' function seems redundant, it includes 'millis' in its header file, it appears to do the same as 'millis'.
Millis will be a count of how long the program is running. It looks like chrono is intended as a stopwatch. As far as I know, millis just counts and cannot be stopped. Chronos appears to use millis to count but has the ability to pause that time then add too it when restarted. It can also be started later.
Note that there could be some issues when using the value from millis. It does not play well with int and using math is an issue.
@photo-bud - sorry for to include this: https://forum.arduino.cc/index.php?topic=570401.0
https://github.com/SofaPirate/Chrono
(Concurrently waiting a reply from developer(s))
I agree with @photo-bud & you - to stick with the Arduino reference when in doubt, but am I not seeing it? The 'chrono' function seems redundant, it includes 'millis' in its header file, it appears to do the same as 'millis'.
???
I will also try a few lines of C++ to experiment more regarding other constructs.
Thanks!
LOL... I've been misled! 😀
When you said:
I am still new to Arduino, but I 'm familiar with c++
... and then you followed up with:
When would you use millis vs. chrono?
... I was fooled into thinking that you were talking about the C++11 version of the chrono class! 😀
But since you posted that link to the source, I now realise that it's a 3rd party library created for Arduino, but NOT a part of the C++ language per se - It's a library specifically created for Arduino, using the C and C++ language!
Now that I understand, and just to be clear for the readers... Chrono (capitol C), is a 3rd party library built for Arduino, and yes, it's not a bad wrapper library at all... I have downloaded it now and tried it out, but at the end of the day, the Chrono 3rd party library just uses millis and micros in the background, so C++ programmers should not confuse it with the real "chrono" library provided by the ISO C++ standard.
Cheers.
Learning both Arduino & different c++ IDEs seem a bit confusing, subtle differences, learning curves, 😵etc. A lot of homework (= a lot of Yoo-Hoo), but still fun!! Pretty soon, I should be able to initially use better descriptive(s) in these forums. I really appreciate everyone's assistance here!🖖🏾
LAW
@wells5150 and @frogandtoad - I've gotta admit I really enjoy how this topic has been "hijacked" and don't mind a bit, as I've learned some new things from it. The dynamics of thread evolution can sometimes be amazing and fruitful.
Photo Bud (aka John)
The Old Curmudgeon!