For example, if we click ON button LED should be ON for 1 second, then OFF for next second, then ON, then OFF, and so on until we press the OFF button.
You could try this code and do let me know too if it works.
A slight change in the timer i.e 1000 now, there was a miss calculation. Do not set the timer to 1 second, instead change the timer to 30 seconds because we cannot make more than 20 API calls in 1 minute and hence would not give you the desired output.
@swapnil.ravi10 Thank you! Yes, it worked but not as I wanted it to be. For 30 seconds programming, It remained OFF for 1st 30 sec and then blinks (did not remain ON for 30 seconds) and again goes off for next 30 sec. I want it to be ON as soon as I click ON button and should remain ON for 30 sec, then OFF for next 30 sec, then again ON for next 30 sec, and so on…
Can you share your code here so that I can edit it for you.
While posting your code, you can use ``` to embed it in the code block.
Apology the delay in response, I missed out on replying to this query.
Please refer the code below - (as you have asked in the first message)
It will stop the timer as soon as you click on the stop button. I have set the time interval for 3 seconds because you might get rate limited for 1 second.
Do let me know in case you need any other information.
@rahul.singh1 Thank you. It worked exactly as I wanted.
@rahul.singh1 what will be the python code for the same logic as above?
As I work mostly on repl.it , I have shared the link to the same.
Hope you got what you wanted!
@abishrant.dey Thank you for the response but I had already figured it out by myself.