<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Two ESP8266 in AP Mode instead of STA? - Arduino				            </title>
            <link>https://www.tweaking4all.com/forum/arduino/two-esp8266-in-ap-mode-instead-of-sta/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 16 Mar 2026 23:59:45 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Two ESP8266 in AP Mode instead of STA?</title>
                        <link>https://www.tweaking4all.com/forum/arduino/two-esp8266-in-ap-mode-instead-of-sta/#post-4104</link>
                        <pubDate>Thu, 07 Apr 2022 13:57:51 +0000</pubDate>
                        <description><![CDATA[Yes, as far as I know, you can setup an ESP as an access point.It is a little hidden in the ESP manual, but here is some documentation with example code.
Hope this helps 😊]]></description>
                        <content:encoded><![CDATA[<p>Yes, as far as I know, you can setup an ESP as an access point.<br />It is a little hidden in the ESP manual, but <a href="https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/soft-access-point-examples.html" target="_blank" rel="noopener">here is some documentation with example code</a>.</p>
<p>Hope this helps 😊 </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/two-esp8266-in-ap-mode-instead-of-sta/#post-4104</guid>
                    </item>
				                    <item>
                        <title>Two ESP8266 in AP Mode instead of STA?</title>
                        <link>https://www.tweaking4all.com/forum/arduino/two-esp8266-in-ap-mode-instead-of-sta/#post-4091</link>
                        <pubDate>Mon, 04 Apr 2022 20:58:40 +0000</pubDate>
                        <description><![CDATA[Hallo at all,
I have two ESP8266,each logs into a wifi and have LEDs connected.both have 1 button to trigger a light signal on the other ESP.This also works very well, when I press a button...]]></description>
                        <content:encoded><![CDATA[<p>Hallo at all,</p>
<p>I have two ESP8266,<br />each logs into a wifi and have LEDs connected.<br />both have 1 button to trigger a light signal on the other ESP.<br />This also works very well, when I press a button on ESP1, the LEDs light up on ESP2.<br />Now I want to use it in the office, but I can not log into the Wlan.<br />Would it be possible that the ESP builds its own Wlan where then the second ESP2 logs on and these then communicate.</p>
<p>Would be great if this would also be feasible with the WLED Project.<br />But this is only a dream :-)</p>
<p>Translated with www.DeepL.com/Translator (free version) Original in German.</p>
<p>Attached is the code of the two ESPs now</p>
<p><strong>ESP1 Transmitter</strong></p>
<pre contenteditable="false">//#define FASTLED_INTERNAL
#include &lt;SPI.h&gt;
#include &lt;ESP8266WiFi.h&gt;            // The Basic Function Of The ESP NODEMCU

// Defining I/O Pins
#define       LED1        16   // LED1
#define       BUTTON_1    5   // Button 1

// WIFI Authentication Variables

char ssid[] = "myNet";                // SSID of your home WiFi
char pass[] = "myPass";               // password of your home WiFi

// WIFI Module Mode &amp; IP

IPAddress server(192,168,3,250);           // the fix IP address of the server
WiFiClient client;

#include &lt;FastLED.h&gt;
// How many leds in your strip?

#define NUM_LEDS 36
#define blinkcount 3
#define DATA_PIN  14 //D5 FastLED 
int buttonState=0;

// Define the array of leds
CRGB leds;

//====================================================================================
void setup() {
  Serial.begin(115200);                     // only for debug
  WiFi.begin(ssid, pass);                   // connects to the WiFi router
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  Serial.println("Connected to wifi");
  Serial.print("IP: ");     Serial.println(WiFi.localIP());
  Serial.print("SSID: "); Serial.println(WiFi.SSID());
  
  pinMode(LED1, OUTPUT);
  pinMode(BUTTON_1, INPUT_PULLUP);  // ESP Pin: INPUT_PULLUP 
  digitalWrite(LED1, LOW);

  // edit one of the following lines for your leds arrangement if needed.
  FastLED.addLeds&lt;WS2812B, DATA_PIN, GRB&gt;(leds, NUM_LEDS);
  pinMode(BUTTON_1, INPUT_PULLUP);
  LEDS.setBrightness(40);
  
  }
//====================================================================================
void loop() {
  digitalWrite(LED1, HIGH);
  ContinuousConnection();
}
//====================================================================================
 void ContinuousConnection(){
  client.connect(server, 80);                       // Connection to the server
  ReadButton();                                     // Read Button from Transmitter
 }
//====================================================================================
void ReadButton() {
  int reading = digitalRead(BUTTON_1);
  if (reading == LOW)
    {
    client.print("I am Transmitter\r");
    delay(200);
  }else{
   ClientContinue(); 
  } 
}
//====================================================================================
void ClientContinue(){
  client.println("Transmitter");                 // sends the message to the server
  String answer = client.readStringUntil('\r');  // receives the answer from the sever
  
  if (answer == "I am Receiver") { // compares if response of receiver is equal to 'SWITCH'
    digitalWrite(LED1, !digitalRead(LED1));      // if it changes the status of the LED
    Serial.println("Data Received: " + answer);

    // received something! Call the LED function
    doLEDEffect();
    
    delay(200);                   // client will trigger the communication 200 milliseconds
  }
}
// ======= LED ========================================================
void doLEDEffect() {
buttonState=digitalRead(BUTTON_1); // put your main code here, to run repeatedly:
  if (buttonState == HIGH){
    for(int blink=0; blink&lt;blinkcount; blink++) {
      for(int i=0; i&lt;NUM_LEDS; i++) {
        leds.setRGB(255,0,0);
        FastLED.show();
        delay(10);
      }
      delay(100);
      for(int i=0; i&lt;NUM_LEDS; i++) {
        leds.setRGB(0,0,0);
        FastLED.show();
        delay(10);
      }
      delay(100);
    }
    setAll(0,0,0);
  }
  else {
    setAll(0,0,0);
  }
}
// Set all LEDs to a given color and apply it (visible)
void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i &lt; NUM_LEDS; i++ ) {
    leds.setRGB(red, green, blue); 
  }
  FastLED.show();
}</pre>
<p><strong>ESP Receiver</strong></p>
<pre contenteditable="false">//#define FASTLED_INTERNAL
#include &lt;SPI.h&gt;
#include &lt;ESP8266WiFi.h&gt;    // The Basic Function Of The ESP NOD MCU

// WIFI Module Config
char ssid[] = "MyNet";                   // SSID of your home WiFi
char pass[] = "myPass";               // password of your home WiFi

WiFiServer server(80);
IPAddress ip(192, 168, 3, 250);           // IP address of the server
IPAddress gateway(192, 168, 3, 1);        // gateway of your network
IPAddress subnet(255, 255, 255, 0);        // subnet mask of your network

// Defining I/O Pins
#define       LED1      16 //D0        // LED Receiver One
#define       SWITCH    5 //D1        // Button

//==========================================================================

#include &lt;FastLED.h&gt;
// How many leds in your strip?

#define NUM_LEDS 36
#define blinkcount 3
#define DATA_PIN 14 //D5
int buttonState=0;

// Define the array of leds
CRGB leds;

//==========================================================================
void setup() {

  Serial.begin(115200);                   // only for debug
  WiFi.config(ip, gateway, subnet);       // forces to use the fix IP
  WiFi.begin(ssid, pass);                 // connects to the WiFi router

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  server.begin();                         // starts the server
  Serial.println("Connected to wifi");
  Serial.print("IP: ");       Serial.println(WiFi.localIP());
  Serial.print("SSID: ");     Serial.println(WiFi.SSID());

  // For the LEDs
  pinMode(LED1, OUTPUT);
  pinMode(SWITCH, INPUT_PULLUP);
  digitalWrite(LED1, LOW);
  
  // edit one of the following lines for your leds arrangement if needed.
  FastLED.addLeds&lt;WS2812B, DATA_PIN, GRB&gt;(leds, NUM_LEDS);
  pinMode(SWITCH, INPUT_PULLUP);
  LEDS.setBrightness(60);
}
void loop() {
  digitalWrite(LED1, HIGH);
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
  // =========================================================================  
  String request = client.readStringUntil('\r');
  if (request == "I am Transmitter") {
    digitalWrite(LED1, !digitalRead(LED1));
    Serial.print("Data Received: "); Serial.println(request);
    
    // received something! Call the LED function
    doLEDEffect();
    
    delay(200);
  }
  int reading = digitalRead(SWITCH);
  if (reading == LOW) {
    client.print("I am Receiver\r");
    delay(200);
  }
  client.println("Receiver\r");      // sends the answer to the client
  delay(100);
}
// ======= LED ========================================================
void doLEDEffect() {
  buttonState=digitalRead(SWITCH); // put your main code here, to run repeatedly:
  if (buttonState == HIGH) {
    for(int blink=0; blink&lt;blinkcount; blink++) {
      for(int i=0; i&lt;NUM_LEDS; i++) {
        leds.setRGB(255,0,0);
        FastLED.show();
        delay(7);
      }
      delay(100);
      for(int i=0; i&lt;NUM_LEDS; i++) {
        leds.setRGB(0,0,0);
        FastLED.show();
        delay(7);
      }
      delay(100);
    }
    setAll(0,0,0);
  }
  else {
    setAll(0,0,0);
  }
}
// Set all LEDs to a given color and apply it (visible)
void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i &lt; NUM_LEDS; i++ ) {
    leds.setRGB(red, green, blue); 
  }
  FastLED.show();
}</pre>
<p> </p>
<p>Thanks</p>
<p>Robi</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>robiv8</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/two-esp8266-in-ap-mode-instead-of-sta/#post-4091</guid>
                    </item>
							        </channel>
        </rss>
		