RichardS wrote:we might have to call you Mr. ESP from now on.
I'm far from been perfect, so I prefer been called ESPBoy ...
Explore... Chat... Share...
Moderator: igrr
RichardS wrote:we might have to call you Mr. ESP from now on.
/* Create a WiFi access point */
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
extern "C" {
#include "user_interface.h"
}
#define WIFI_MODE_AP
/* Set these to your desired credentials. */
const char *ssid = "Proximity Trigger 1";
const char *password = "thereisnospoon";
//Reference station counter as "devices"
unsigned char devices;
// boolean ledState = false;
int alreadyBlinked = 0;
unsigned int prevMillis = 0;
ESP8266WebServer server(80);
void handleRoot() {
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
//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();
}
void loop() {
devices = wifi_softap_get_station_num();
if (devices == 0) {
alreadyBlinked = 0;
}
else if (alreadyBlinked == 0) {
digitalWrite(2, HIGH);
prevMillis = millis();
alreadyBlinked = 1;
}
if (alreadyBlinked > 0 && (millis() - prevMillis) > 1000) {
digitalWrite(2, LOW);
}
server.handleClient();
}
void loop() {
if ((millis() - prevMillis) > 1000) {
prevMillis = millis();
devices = 0;
struct station_info *stat_info = wifi_softap_get_station_info();
while (stat_info != NULL) {
stat_info = STAILQ_NEXT(stat_info, next);
devices++;
}
if (alreadyBlinked > 0) {
digitalWrite(16, LOW);
prevMillis = millis();
}
}
if (devices == 0) {
alreadyBlinked = 0;
}
else if (alreadyBlinked == 0) {
digitalWrite(16, HIGH);
prevMillis = millis();
alreadyBlinked = 1;
}
server.handleClient();
}
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]