Schedule fix desired time to control servo motor

My project will use nodemcu esp8266 which will use wifi for the connection to the app. Will it work if i just program it through mit?

But, my question is why do you want to keep feeding MCU with phone system time, once you have send a fixed time to Microcontroller then you can relax, since rest will be handled by MCU, and your app can only need to be in picture when you decide to set new time, from 9AM to 3PM.

If I make the selection in arduino code, do I still need to make the selection blocks in mit as well?

I do not think so. Did you try it? I suspect it will not run.

Here is how to determine the time the servo should be on. For your purposes, you need lots more code to interface to your arduino. Sorry, I cannot help you with that.

This is a modification of the code Taifun provided on StackOverflow. It corrects an issue with his code (use of <= ).

1 Like

Thanks for this one, I will try it out

I don't know if what you want is to set a time and when that time arrives a message is sent to the ESP8266, in this case your code would have to work in the background with some of the extensions.
Or what you want is to send an order to the ESP8266 and when that time comes for it to control the servo, in this case you would only have to send with the WEB.url component:,stop= 9.30
In this case, the greatest weight of the code would have the ESP8266.

Here you can see an idea.

Thanks for the idea. When set the Web1 URL, does it need to state the GPIO pin that we used in the system? For example like "http://ipaddress/gpio/0". Based on here, is it possible if I make the time delay only for turning it ON? Because the servo will automatically OFF when the weight of the food in bowl reach 450g. I already coded about the weight sensor stuff. So I just need to make it turn ON via MIT app.
Sorry for making all of you confuse about my topic.

Send a start order http ://ipaddress/on

does it need to state the GPIO pin that we used in the system?

Check the code from other tutorials, in this case it is the ESP32 similar to the ESP8266...

1 Like

Thanks for the reply. From the topic you have shared, I did not understand about the client.printIn for the webpage. Does the webpage code is necessary? Because I use an image as a button, so do i need to state it as image or button in the code?
To allow the "http://ipaddress/on", is it a must to set the nodemcu as access point? Because the nodemcu 8266 is already been connected through wifi & already generated an ipaddress: "". So is will work like this "" or "http://ipaddress/on" ?

In your previous message you wrote...
...used in the system? For example like "http:// ipaddress/gpio/0". Based on here, is it...

that's why I used the example like http:// ipaddress

If it is an access point or WiFi client and you already know the IP, you can put


After that number you write an expression, for example
that expression will reach the ESP8266 by...
GET /gpio/on HTTP/1.1
GET /gpio/off HTTP/1.1
GET /on_led HTTP/1.1
GET /off_led HTTP/1.1
GET /give_me_random HTTP/1.1

The code will check if that message contains the sent expression...

if (received.indexOf("gpio/on") != -1){
if (received.indexOf("gpio/off") != -1){
if (received.indexOf("gpio/led_on") != -1){
if (received.indexOf("gpio/led_off") != -1){
if (received.indexOf("give_me_random") != -1){

The webpage is used in case you want the ESP8266 to send you a response message, it will receive it in Web.GotText.responseContent

Check this example...

Hello its me again. Sorry for late update, i already try it out using thingspeak but the value of thingspeak not change to 1 when the time comes. How can i make it work? is my mit blocks okay?

I already try to change my nodemcu into access point, but if i did that my weight sensor in my project will not functioning.

Sorry. Your Block image is illegible. I cannot see what you are doing. :cry:

Keep in mind, the example provided earlier does not run in the background. It only checks the time of day when it is first run; that is probably your issue (you expect the app to work continuously to trigger as the time changes.

illegible? is it you cannot view my block image? This means that the example block you show just to display the time? Could give me an example of a block diagram for a system that play sound when the specific times comes?
Down below is the link to view my block image in mit;

image still has insufficient resolution.

Sorry, I cannot provide you code that will run in the background. Try coding yourself using similar code with Open Source • Background Tasks: Itoo

Question remains the same @Ai_Man

Thanks for the advice. I will try this one :smiley:

I'm using wifi as for connection with nodemcu and the apps. Because if using phone system time, it does not need the rtc module right?

Ok, but, with out on-board clock,

requiring you to have/think more resourses to build your system, isn't it?

And, how about trying to feed your MCU board sync with current time from web api call.