Please HELP ! Error 1101: Unable to get a response with the specified URL

348 views
Skip to first unread message

Teddy Sinatryo

unread,
Aug 27, 2018, 10:28:45 AM8/27/18
to mitappinv...@googlegroups.com
Hello everyone, i am a newbie in app developer.
I want show the sensor value from NodeMcu ESP 8266 to my android phone, but when i click the button it show.
"Error 1101: Unable to get a response with the specified URL:https://192.168.1.100/sm".

i'm using NodeMcu ESP 8266 as the server, and my android phone was the client. they connected in the same access point.

But i can see the value from serial monitor, and LCD then i can control relay too from my android phone.
please, someone can help me ?
Prototype_NodeMCU.ino
BlockScreen3.png
DesignSCREEN3.png
Screenshot_2018-08-27-21-23-58-589_appinventor.ai_Teddy_Sinatryo.PrototypeSKRIPSI.png
PrototypeNodeMCU.aia

Teddy Sinatryo

unread,
Aug 28, 2018, 5:59:23 PM8/28/18
to MIT App Inventor Forum
Anyone, please help me...

Chris Ward

unread,
Aug 28, 2018, 8:07:07 PM8/28/18
to MIT App Inventor Forum
Hello Teddy

You are calling the URL on Screen3 - what is happening on the other screens?

Chris Ward

unread,
Aug 28, 2018, 8:29:50 PM8/28/18
to mitappinv...@googlegroups.com
You might get more info about the issue like this:

Get Error Info.png


GetErrorInfo.aia

Teddy Sinatryo

unread,
Aug 29, 2018, 1:29:09 AM8/29/18
to MIT App Inventor Forum
Hallo Chris

the other screens is running correctly except screen3, this screen is to get sensor data from NodeMCU but it cant.

Teddy Sinatryo

unread,
Aug 29, 2018, 1:48:20 AM8/29/18
to MIT App Inventor Forum
i got this from your get error info.

Screenshot_2018-08-29-12-44-15-078_appinventor.ai_Teddy_Sinatryo.PrototypeSKRIPSI.png


Juan Antonio

unread,
Aug 29, 2018, 5:03:26 AM8/29/18
to MIT App Inventor Forum
Hi,

- Try with a Button (not Clock)

- Try in a browser, Chrome...: http://192.168.1.100/sm

José Ceolin

unread,
Aug 29, 2018, 5:41:16 AM8/29/18
to MIT App Inventor Forum
Hello. First of all I would like to apologize for the English.
I am having the same problem and I believe it is an application bug.
Nodemcu is the webserver, and the application that is the client tries to connect to the server through the IP http://192.168.4.1/function. For some reason, the connection does not occur when requested by the application. But when the GET is done by browsing the notebook, it works perfectly. The connection is made and the response is returned.
I have seen many requests for help for this problem and none of them have come up with a solution. I look forward to someone helping with a solution.

Juan Antonio

unread,
Aug 29, 2018, 6:31:06 AM8/29/18
to MIT App Inventor Forum

Chris Ward

unread,
Aug 29, 2018, 7:50:56 AM8/29/18
to MIT App Inventor Forum
Hi Teddy

The reason I asked about the other screens is because, working or not, you might have something in there that affects what happens on Screen3. 

Your use of the Clock on Screen3 seems superfluous, but we can't see the the flow of your process from the information you have given.

Perform Juan's little test with Google Chrome and let us know the result.

Teddy Sinatryo

unread,
Aug 29, 2018, 12:27:17 PM8/29/18
to MIT App Inventor Forum
Hi juan,

i need to use clock for refresh sensor data every 3 second. 

I've tried it before, but it show nothing, just blank.

Teddy Sinatryo

unread,
Aug 29, 2018, 12:40:03 PM8/29/18
to mitappinv...@googlegroups.com
Hi again christ,

I've added .aia program I made in my post was started, so you can see all the screens I use.

the clock I use is to refresh the sensor data every 3 seconds.

I've done what I suggested before, but the browser doesn't display anything, like nothing....

Juan Antonio

unread,
Aug 29, 2018, 1:30:10 PM8/29/18
to MIT App Inventor Forum
Try this simple code as HTML

  if (val==2){
  client.println("HTTP/1.1 200 OK");
  client.println("Content-Type: text/html");
  client.println("");
  client.println("<!DOCTYPE HTML>");
  client.println("<html>");
  client.println("<head><meta charset=utf-8></head>");
  client.println("<body>123456789");
  client.println("</body></html>");
}

Teddy Sinatryo

unread,
Aug 29, 2018, 1:39:46 PM8/29/18
to MIT App Inventor Forum
I'm not sure if this code can display soil moisture data at MIT App Inventor, Juan.

Shawn McClintock

unread,
Aug 29, 2018, 2:02:46 PM8/29/18
to MIT App Inventor Forum
Looking at your INO code, you've never started the HTTP server. If you start the server you wouldn't get an unresponsive error, you'd get data. Use code such as : https://www.teachmemicro.com/simple-nodemcu-web-server/ and see if it responds. If so then modify to your needs. 

Shawn McClintock

unread,
Aug 29, 2018, 2:05:04 PM8/29/18
to MIT App Inventor Forum
For pushing data to clients there are again many many examples, one of which is here: https://www.instructables.com/id/Push-Data-From-ESP-Webserver-to-Client/ give it a try

Teddy Sinatryo

unread,
Aug 30, 2018, 2:51:53 PM8/30/18
to MIT App Inventor Forum
Its working sir! but I'm too confused to modify it according to my needs :(

Shawn McClintock

unread,
Aug 30, 2018, 5:41:52 PM8/30/18
to mitappinv...@googlegroups.com
The second example has a very easy to implement server, 

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>   <<ADD THIS TO YOUR SKETCH
#include <ESP8266mDNS.h>  <<ADD THIS TO YOUR SKETCH

/* based on helloserver
this is in the public domain

This sketch sends data to a website that receives it in an event.
I would call this 'pseudo-push'
See push.html for the client side
*/
// Use your info here
const char* ssid = "myssid";
const char* password = "mypassword";

ESP8266WebServer server(80);  << this turns the server on! without you will never get an http response

const int led = 5;
// Add until next note
void handleRoot() {
 
  server.send(200, "text/plain", "hello from esp8266!");
  digitalWrite(led, 0);
  
}

void handleNotFound(){
  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
  digitalWrite(led, 1);
}

void setup(void){
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  if (MDNS.begin("esp8266")) {
    Serial.println("MDNS responder started");
  }

  server.on("/", handleRoot);

  

server.on("/zend", [](){
  
  char str[80];
   sprintf(str, "data: Send %d \n\n", i);
  server.sendHeader("Cache-Control", "no-cache");
  server.send(200, "text/event-stream", str);

});

  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started");
}

void loop(void){
  server.handleClient();
i++;
if (i>600000) i=0;
 
}

// Plug those lines into your working sketch, modify as needed to display your sensor data

Shawn McClintock

unread,
Aug 30, 2018, 5:45:42 PM8/30/18
to MIT App Inventor Forum
You can put the code listed onto your NODEMCU to verify it all works as it should. this is very simple, all you need to do is TAKE the parts in RED and put them in your existing sketch, create a bit of code to send your sensor value, easy. 

Teddy Sinatryo

unread,
Aug 30, 2018, 6:06:58 PM8/30/18
to MIT App Inventor Forum
Arduino: 1.8.6 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, 4M (3M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Teddy Sinatryo\Desktop\HELP_\HELP_.ino: In lambda function:

HELP_:74:39: error: 'i' was not declared in this scope

    sprintf(str, "data: Send %d \n\n", i);

                                       ^

C:\Users\Teddy Sinatryo\Desktop\HELP_\HELP_.ino: In function 'void loop()':

HELP_:88:1: error: 'i' was not declared in this scope

 i++;

 ^

C:\Users\Teddy Sinatryo\Desktop\HELP_\HELP_.ino: At global scope:

HELP_:94:1: error: expected declaration before '}' token

 }

 ^

exit status 1
'i' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.





I got this error sir.

Shawn McClintock

unread,
Aug 30, 2018, 6:31:56 PM8/30/18
to MIT App Inventor Forum
that is why you need to EDIT it to reflect YOUR variables. IT WILL NOT work until you do this. It is not written for your specific needs, but it is a template for you to be able to create a web page and serve it via http. THIS is what modify it to your needs means.

Shawn McClintock

unread,
Aug 30, 2018, 6:36:01 PM8/30/18
to MIT App Inventor Forum
Also, READ READ READ more examples of push server for NodeMCU, there are tons of walkthroughs and examples out there, rehashing it here is redundant. This is what you need, you just need to figure out how to combine that with your existing code.
 
Reply all
Reply to author
Forward
0 new messages