cattledog:
[...] Why not set a flag and execute the function in loop() with blink without delay. Teaching the use of flag setting in an ISR is a valuable lesson.
You may believe differently, but when you see all the broken ISR's posted on this forum, and posters asking for help it leads me to be skeptical of your approach.
Thanks for the valuable comment. I have noted it down.
Yes! Blink without delay would be an excellent approach to keep the ISR short.
//----------------------------------------------------------------------------------------------------------
Let me share with the readers my experiences of teaching interrupt (or any other) concepts with the senior level graduate students of Electrical Engineering:
(1) As a faculty, one has to prepare a working experiment that gives a visible result, and the experiment should be reproduceable. The faculty makes the experiment in accordance with his level of understanding of the subject matter and the practical experience.
(2) The faculty must prepare the step-by-step procedures of the experiment so that each and every student can reproduce the result just by following the steps.
(3) The faculty goes into interactive section with the pupils to review the theoretical and the setup aspects of the experiments.
(4) The pupils are again asked to repeat the experiment and justify the necessity of the steps as have been laid down in the experiment.
(5) The students are now allowed to search in the web or among themselves to look for alternative or better ways of doing the experiment.
(6 In 3x50 minutes class, the faculty and the students (a few of good quality) have time to play around with the experiment. The advantage is that the students have their own (purchased) Arduino UNO Learning Kits.
(7) My understanding is: These are Electrical Engineering level students. They don't have wide exposure to programming arena like the CSE students. Very often, we need to go to assembly level to make them understand what is going on at the register/memory level of the MCU.
//-----------------------------------------------------------------------------------------------------------