My question might be very basic. Unfortunately, I am yet to get the understanding. Here's the scenario. There are two LEDs.
Case 01: One of them blinks for ever at 1000 mSec interval
Case 02: The tactile switch is connected to digital input. When the digital input is HIGH (when the switch is pressed) the second LED blinks rapidly at 100 mSec interval for 1 Sec and turns LOW. Again, when the input becomes HIGH this activity by LED 02 restarts
Now, what-so-ever is the LED 02's activity (HIGH/LOW), the LED 01 shouldn't stop blinking (the loop needs to go on)
I want to get the hint at how this works. I mean how the multi-tasking is done (is this possible?). Can someone please provide the sketch (bear with me )? (just not able to understand at what goes inside the void loop(){})
The secret is that turning on an LED is just a single event. (something like digitalWrite(somePin, HIGH). Once you've executed such a task, you don't have to sit and watch it. It will stay on, just fine all by itself.
When you turn it off again. Once more just a simple task (digitalWrite(somePin, LOW). Having done so the sketch can continue to go about it's business, nothing more to see here folks.
So to blink an LED all you have to do, is drop in now and again, to see if it needs attention.
Think of security guard that locks all the doors at night and unlocks them the next morning. How does he keep them ALL unlocked for the whole day. After all he can only stand by one of them? Now you see how rdiculous such a problem sounds?