-->
Page 1 of 3

Rename SSID every few seconds?

PostPosted: Tue Feb 05, 2019 11:54 am
by pablopablo
Hi everybody,

I have an idea for a project and wanted to ask if it is possible and if anyone can point me in the right direction?

I would like to have an ESP8266 that when powered on broadcasts a specific SSID (EG APPLE) and then after a couple of seconds (without powering it off) it automatically renames the SSID (EG BANANA) and so on...

It is not neccasry for anybody to connect to the ESP/WIFI nor is a password needed

I'm assuming that some sort of loop might work...

Any advice greatly appreciated etc.

Re: Rename SSID every few seconds?

PostPosted: Tue Feb 05, 2019 12:02 pm
by torntrousers
Something like this perhaps (note, I've not actually tried this on an ESP!):
Code: Select all#include <ESP8266WiFi.h>

void setup() {
  WiFi.persistent(false);
  WiFi.mode(WIFI_AP);
}

int counter;

void loop() {
  WiFi.softAP("SSID"+counter, "somePswd");
  delay(2000);
}

Re: Rename SSID every few seconds?

PostPosted: Tue Feb 05, 2019 12:11 pm
by pablopablo
torntrousers wrote:Something like this perhaps (note, I've not actually tried this on an ESP!):
Code: Select all#include <ESP8266WiFi.h>

void setup() {
  WiFi.persistent(false);
  WiFi.mode(WIFI_AP);
}

int counter;

void loop() {
  WiFi.softAP("SSID"+counter, "somePswd");
  delay(2000);
}



Thanks for the quick reply...I now realise I may have worded my op wrongly/confusingly!

So, it's not actually a number (I just did it as a (bad) example!)

Something like this:

SSID is at first Apple, then after 10 seconds changes to Banana, then after another 10 seconds changes to Orange...and so on.

Also, no need for passwords...

Thanks again and sorry for confusion!

Re: Rename SSID every few seconds?

PostPosted: Tue Feb 05, 2019 12:45 pm
by torntrousers
Code: Select all#include <ESP8266WiFi.h>

String ssids[] = { "Apple", "Banana",  "Orange"};
int howManySsids = 3;
 
void setup() {
  WiFi.persistent(false);
  WiFi.mode(WIFI_AP);
}

int i;

void loop() {
  WiFi.softAP(ssids[i++].c_str());
  if (i >= howManySsids) i = 0;
  delay(10000); 
}