Setting the timer when the LED will turn ON and OFF using NodeMCU


I am new to Arduino programming. I would greatly appreciate if anyone could give me some idea regarding the following matter.

I want to turn ON and OFF a LED bulb based on the timer set by the user through his Blynk app. My idea is that the NodeMCU would fetch the current time from the NTP server and display it in the Blynk app. The user then should be able to choose a specific time e.g. turn off LED at 6:30pm. Could anyone assist me with how to write the coding for turning off the LED based on the timing set by the user in the Blynk app?

Thanks a lot in advance. Very Sorry if my question is unclear.

Your best bet is to find some examples that already do some of that stuff and start playing. It's too ambitious a project for someone here to just whip up some code for you.

1 Like

If you’ve done some work so far, e,g. to get the NTP time, and the general Blynk functions… Post that here - in code tags and we can help.

Possibly include a screen shot of your Blynk applet showing the fields and their names so we can relate them to your code.

1 Like

Understood. Thanks for your suggestion.

Havent start working on the coding yet. I have found some idea on the coding section regarding getting the NTP time from various websites. The only difficulty I am finding is on how to add the off timer to the coding.

Anyways thanks for your suggestions.

It's nearly impossible to implement generalities in code without knowing the code framework. The algorithm of an off timer is very simple really. You just record the current time, on any activity. Then, continously subtract that from the current time. If the difference exceeds some defined interval, turn off.

1 Like

I see. Thanks a lot for the idea. I will start working on the coding and then share the code framework here for some suggestions.