pinToggle library - comments please

Thanks for the comments which I will take on board.

pinToggle::bindToPin(byte pin)I like the name but I have already moved the binding to the pin back into the constructor where it was originally which makes creating an array of objects easy and the init() function has been renamed to begin() in line with most libraries, whilst startToggling() actually starts the toggling process.

The member names may have tons of meaning to you when you write it, but look back on it in three months time and you will be scratching your head, thinking: "Who the heck wrote this"? It happens to everyone.

I am sure that you are right. See you in 3 months !

Your comment about the lack of explicit return types is interesting because I did it deliberately, but looking back I can only imagine that I did it because the constructor does not have a return type. To quote from http://www.cplusplus.com/doc/tutorial/classes/

This constructor function is declared just like a regular member function, but with a name that matches the class name and without any return type; not even void.

Having written the constructor I can only imagine that I wrongly followed suit with the other functions. I will certainly be fixing it although it seems to cause no problem, or at least not one that I have noticed.

How about a callback function when the pin toggling is completed?

A good idea that I will look into.

Cheers to you for doing that....

Thanks for the encouragement. You and I have not always agreed in the past, usually when your proposed solutions to a problem, whilst technically correct, seemed (to me at least) to be unnecessarily confusing (ranged based for loops anyone ?). Having caught the class/library disease I will have to be careful in suggesting their use to solve simple problems, won't I :slight_smile: I have already created a small class to turn on a LED on or off for a period using millis(). Will I be suggesting using it the next time I see a "my program is full of delay()s dealing with LEDs and won't respond to button presses" query ? Only time will tell.