How do I stop playing sound by switching between toggle button?
问题 I have made an alarm clock and there I have used a toggle switch to start my alarm. What I want is as soon as the user click on the button again, it should stop the alarm (ring). Toggling between ON and OFF wil start and stop respectively. But right now, I am only able to start my alarm. In fact it never gets stopped. If I switch the button OFF the sound gets played even faster, that is very strange. How can I stop it? I have pasted the only part of code where I am assuming the problem occurs