I hope I am posting this question in the right section. I am making a Smart Home Project for my college semester finals. I am using an Atmega328p microcontroller along with an ESP8266 (Esp 01). The Atmega328p controls all the sensors and actuators and sends the data to Esp01 via serial communication.
I have created a web server on the Esp01 which I plan to access by creating an app using MIT App Inventor. My GET request is of the format "http://192.168.43.42/4" where the digit at the end is data I want to send to the server and the response I get from the server is of the format "12&0&34.8" where the '&' is used to separate different values.
My problem is , when I access the server from Chrome in my laptop I get the desired response but when I access it using the App , I get an error "Error 1101 :Cannot find the specified URL". The Esp01 is connecting to a hotspot from my phone and I have checked the IP assigned to the Esp01 to ensure my GET request is correct.
The code for Esp01 in Arduino IDE is here : https://gist.github.com/TheMagicSmoke/467d6227d670697464038056e22f302d
The blocks for the app made in App Inventor is below: enter image description here
The GET request URL when entered from Chrome in laptop returns a blank page at first but upon refreshing Chrome I get the desired response I told earlier. And in the app , I have used a timer which queries the server with the same GET request every 2 seconds. But when I open the App the error keeps on popping up. Please suggest me a solution, I have googled this without any success.
-
Is MIT AppInventor something that runs locally on a device or computer on your network, or something that runs on a website somewhere?Majenko– Majenko2019年04月22日 14:50:13 +00:00Commented Apr 22, 2019 at 14:50
-
I have edited the title as it seemed misleading. What I meant is that I am accessing the server using an Android app that was created using MIT App Inventor which is a website.user151016– user1510162019年04月22日 14:54:22 +00:00Commented Apr 22, 2019 at 14:54
-
I'm finding it hard to find any concrete information, but it looks like the "app" on your phone may just be a front-end to the MIT web servers and the code actually runs on there, not your phone - which means that the code can't get at what is inside your network - only things that are on the internet.Majenko– Majenko2019年04月22日 14:59:45 +00:00Commented Apr 22, 2019 at 14:59
-
1did you try to access the page from a browser on the phone?Juraj– Juraj ♦2019年04月22日 16:55:33 +00:00Commented Apr 22, 2019 at 16:55
-
1Can Yo post. aia file? Many thx in advance. Tomtomavka– tomavka2021年07月22日 18:41:42 +00:00Commented Jul 22, 2021 at 18:41
1 Answer 1
I have found out the solution to this problem. The code that I had written in the Arduino IDE for the Esp8266 was not correct for handling the GET request. It only accepted data as a simple Web Server and not as a HTTP server. I am posting the modified code below .
https://gist.github.com/TheMagicSmoke/adaae1e4d92f258c88184c8690e68f08
-
so I didn't look at your code (the first version). I expected that you used the WiFiWebServer example not a sketch, which expects data 10 milliseconds after connect, else it fails2019年04月23日 19:54:56 +00:00Commented Apr 23, 2019 at 19:54
Explore related questions
See similar questions with these tags.