Go Down

Topic: New Library: muTimer / Delay (non-blocking) (Read 851 times) previous topic - next topic

michael_uray

#15
Jan 03, 2021, 11:46 pm Last Edit: Jan 04, 2021, 04:20 am by michael_uray
So just call it muDebounce() ?
99% of Arduino folks will not be starting from a knowledge of PLCs so compatibility is irrelevant and the transfer of understanding even less relevant.

In my mind functions should have simple and obvious names so that the user does not have to scratch his head (or check the manual) to remember what they are for or how to use them. Also "obvious" should mean "obvious in the context of the user's existing knowledge" (not the programmers existing knowledge).
My intention was to create a simple generic on- and off-delay as for example a classic time delay relay would provide.
Such an on/off delay can get used to debounce a switch or a button, but it is not its main purpose. Its actual main purpose is to provide an on and off delay for any digital signal.
I did rename the timerOnOff() function in the meanwhile to delayOnOff() to make it easier to understand by its name. I also did consider to name it delayHighLow or delayTrueFalse, but I think on- and off delay would be the thing what most of the people understand.


That may mean having more functions in a library, several of which may use near-identical code. Or perhaps one function would call another after adding some parameter so the user would not have to.
I have this done for this reason on a couple functions, for example with the delayOn() and delayOff() functions which internally just call delayOnOff().


Means now the functions
delayOn()
delayOff()
delayOnOff()
provide simple on and off delays for any digital signal.

The function cycleOnOff() provides a simple cyclically on/off output, for example to blink a LED.

cycleTrigger() allows to run periodically any action once after each cycle.

Robin2

Noted.

Best wishes with the project.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

michael_uray

Noted.

Best wishes with the project.
Thank you very much for your support here Robin, I appreciate that.
You definitly helped me to improve the documentation very much as well as to find the right names for the functions.


PS:
It looks as such a library is like an anthill, there is always something to do, to improve or extend it.

Robin2

#18
Jan 04, 2021, 03:40 pm Last Edit: Jan 04, 2021, 03:41 pm by Robin2
PS:
It looks as such a library is like an anthill, there is always something to do, to improve or extend it.
Probably the reason I have never felt like writing a library.  :)  :)

And once you start extending or enhancing a library the issue of backwards compatibility comes to the fore.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

michael_uray

The instructions are here:
https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ
Please let me know if you have any questions.
Thanks for the instructions, I was able to get the library added to the library manager and it is already showing up there.

But for some reason does it not show up on the Arduino website in the section timing, even the section got choosen properly in the library.properties file.

Is there something else required to do, or does it just take some more time to show up there?

pert

There is definitely no other process required from the library authors to get into the Arduino library reference pages. I don't know, but based on it being this way with the Arduino Language Reference pages, I suspect the update of these pages needs to be manually initiated. So it's a matter of waiting for someone with the necessary access to get around to it.

The auto-generated Library Manager reference pages are a relatively new advancement and there have been some glitches since it was added, so it's definitely not a bad idea to check back periodically and if if it still doesn't show up report the issue via the support form:
https://www.arduino.cc/en/contact-us/

Go Up