pinToggle library - comments please

UKHeliBob:
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.

I'd like to think that classes were developed to make programming easier!

I've been teaching a workshop for 6th, 7th and 8th graders using Arduino and Particle. Most recently I've switched from teaching variables and functions first to teaching classes first.

  • this is a class, an object, a container of things
  • the things that classes may contain are variables and/or functions
  • this is a variable...
  • this is a function...
  • this is what's meant by private and public
  • structs are classes
  • oh, by the way, variables and functions can exist in the wild and on their own...
  • variable scope

the kids got it right away, so I'm going to continue using this sequence for a while. When I introduced classes after variables, functions and scope... they struggled more.