Nodemcu -> MIT App Inventor send Data

Hello everybody,

i have build a app with MIT app inventor. The app controlls a nodemcu ESP8266. In this app i can controll some relays. Now i would like to send data (temperature) from the nodemcu to the app. But i don't know what i have to do now. I searched a lot of theatrs in the internet since four days.

How do I have to write the program in Arduino? How do I have to build the right app in app inventor? Does anyone have suggestions?

I hope you can help me..

WiFiWebServerunknown.ino (3.33 KB)

MITblocks1.PNG

ESP servers your phone app, esp can not send data to your app straight up unless you request for it

and this is where 'polling' comes in

you need to periodically 'poll' to fetch data from the ESP

you could like send http://192.168.xx.xx/poll to ESP every 2 secs may be, and ESP responds (echo) back

with event server.send(200, "text/plain",message);

where as in 'message' you will be attaching your sensors data as string

in app inventor , you be using component 'Web.GotValue' to get the response

Okey thank you for your information. I'm sorry i connot understand u. I have now visit a lot off websites to get some informations. But i don't found the right one. Can u explain me this part again. Can you make a example?

It would be very nice.
Thank you very much

kind regards

see these

Hey, I tried the above code and got the following error:

'class WiFiServer' has no member named 'on'
'class WiFiServer' has no member named 'send'

  1. Could you help me to solve this error
  2. and my purpose is to send data from the node MCU(server) to MIT app(client) without any request from the app.

Thanks! Please reply asap!