martinayotte wrote:The example above is pretty straight forward.
Instead of doing WiFi.begin() and WiFi.status(), simply do the following as in the example :Code: Select allWiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
Thank you again,
Now I have following, but there doesn't seem to appear an SSID with the name "MySSID" to be around:
#include <DHT.h>
#include <DHT_U.h>
#include <ESP8266WiFi.h>
#include "espipswitchtoggle.h"
const char* ssid = "MySSID";
const char* password = "Pass";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
unsigned long timer = 0;
unsigned long firstMillis = 0;
void setup() {
Serial.begin(115200);
delay(10);
pinMode(0, OUTPUT);
pinMode(2,INPUT);
pinMode(2, INPUT_PULLUP);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
unsigned long currentMillis = millis();
if(currentMillis - firstMillis > (timer*60000)) {
digitalWrite(0, 0);
firstMillis = currentMillis;
}
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println("new client");
while(!client.available()){
delay(1);
}
// Read the first line of the request
String command1 = client.readStringUntil('/');
String command = client.readStringUntil('/');
Serial.println(command);
if (command == "12") {
if(digitalRead(0))
{
digitalWrite(0, 0);
client.print(F("0,0"));
}
else
{
digitalWrite(0, 1);
client.print(F("0,1"));