So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By NickLD
#59958
owensv wrote:
NickLD wrote:If I understand you correctly, it sounds like you want to make the ESP a WiFi hotspot and have it serve up a simple webpage, correct?

If so, Then yes, it is possible. You can do this with the ESP NativeSDK, Arduino framework, NODEMCU LUA framework, Python, and Javascript framework(s).

There are many examples of how to do just what you are looking for on each of those framework options. For simplicity, I'll show you the Arduino framework version. (Example copy-pasted from WiFiAccessPoint example sketch)




Code: Select all/*
 * Copyright (c) 2015, Majenko Technologies
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * * Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 *
 * * Redistributions in binary form must reproduce the above copyright notice, this
 *   list of conditions and the following disclaimer in the documentation and/or
 *   other materials provided with the distribution.
 *
 * * Neither the name of Majenko Technologies nor the names of its
 *   contributors may be used to endorse or promote products derived from
 *   this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/* Create a WiFi access point and provide a web server on it. */

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

/* Set these to your desired credentials. */
const char *ssid = "ESPap";
const char *password = "thereisnospoon";

ESP8266WebServer server(80);

/* Just a little test message.  Go to http://192.168.4.1 in a web browser
 * connected to this access point to see it.
 */
void handleRoot() {
   server.send(200, "text/html", "<h1>You are connected</h1>");
}

void setup() {
   delay(1000);
   Serial.begin(115200);
   Serial.println();
   Serial.print("Configuring access point...");
   /* You can remove the password parameter if you want the AP to be open. */
   WiFi.softAP(ssid, password);

   IPAddress myIP = WiFi.softAPIP();
   Serial.print("AP IP address: ");
   Serial.println(myIP);
   server.on("/", handleRoot);
   server.begin();
   Serial.println("HTTP server started");
}

void loop() {
   server.handleClient();
}


NickLD - Thank you. This does look hopeful. Let me ask, please, specifically where you got your referenced material. (As I say, I am new to this device.) I have downloaded the NONOS SDK; is this the same as the "Native SDK" to which you refer? And then, where did you get the WiFiAccessPoint sketch? I imagine there are other things there which may be of interest to me. All I have found so far is from a website called Espressif, linked to from the ESP documentation. I downloaded their tools as called for in their Quick Start Guide. I suspect experienced users may have other or better tools and sources. Thanks for any pointers.



Sorry for late reply. That example is specific to the Arduino framework for the ESP8266. It uses the Native SDK under the hood but adds in lots of helper classes and 'libraries' to make it easy to quickly develop. (You can access the native SDK in the Arduino Framework if you desire) Take a look at their Github page(https://github.com/esp8266/Arduino/). It has install instructions and explains everything you need to know on how to get started.
User avatar
By Paul OE8PCK
#60015 This is exactly what i need, but how do I refresh the IP every 2 seconds without having to do this manually?
PLEASE help.

Thank you.

Paul