Hello everyone, first off I have been working with Arduino IDE in conjunction with the Wemos Mini D1 and the ESP8266 Dev Board. My hobby since retirement. This is not my area of expertise so I rate myself as a beginner.
I created a sketch for taking on the tasks of plant and lawn watering with ESP8266 controller
The front end is a crude text-based web page that I found and used from the web. It was a cut and paste no programming knowledge on my part.
What I would like to do is create a front end for my cell phone to control watering sketch mentioned above. Maybe override button for emergencies and calendar for when to water and clock for the time duration.
This is where MIT App Inventor comes into play, unfortunately, can not find clear step-by-step tutorials to guide me through the process.
Found one step by step tutorial but it was lacking and left out steps the author thought were obvious. I did manage to get it working but it posted an error and stopped working after about a minute. If I cut power to the ESP8266 Dev Bd it would work again but stop after a minute.
The author could not be reached so here I am.
I will link the example that failed if requested also will show code for my lawn sprinkler sketch if needed. Right now, what I need is learning how to use MAI. I have read and watched many tutorials both on the MIT site and around the web nothing so far.
If I left anything out please feel free to let me know.
int val;
if (req.indexOf("/gpio/0") != -1)
val = 0;
else if (req.indexOf("/gpio/1") != -1)
val = 1;
else {
Serial.println("invalid request");
client.stop();
return;
}
// Set GPIO2 according to the request
digitalWrite(2, val);
client.flush();
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n\r\nGPIO is now ";
s += (val)?"high":"low";
s += "";
}
Here is the error that pops up on my cell phone after pressing either button it eventuall y fades but returns after pressing either of the two buttons.
I currently following his lessons and have his book. I was able to use the app as outlined in my OP did not try opening using a browser on my cell phone. It did however work with my desktop PC browser without any errors.
UPDATE: tried using my cell phone and browser and was able to control the LED via that method.
OK I was able to run the example from my cell phone and watched the onboard leds turn on and off. Thought that qualified for connection between the cell phone and my wifi network which is where the ESP8266 is located.
Sorry for the duplicate post but tried as you requested and was able to get the led to switch on/off using browser on my cell phone. Sorry what is "Web Viewer replacement"?