ESP8266

there are some codes available on "GitHub - esp8266/Arduino: ESP8266 core for Arduino" . I made the code work by modifying it a little but the main problem is that it Exchange data only once ,the server closes the connection when a one data exchanged .i want a continues TCP socket connection (send/receive )

this is my code :

#include <ESP8266WiFi.h>

const char *ssid = "ESPaliAP";
const char *password = "12345678hamed";

WiFiServer server(21);

char incomingPacket[255];
char replyPacekt[] = "Hi there! Got the message :-)";

// the setup function runs once when you press reset or power the board
void setup() {
pinMode(2, OUTPUT);
digitalWrite(2, 1);
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point...");
WiFi.disconnect();
delay(100);
WiFi.mode(WIFI_STA);
// 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);

// Start the server
server.begin();
Serial.println("Server started");

// Print the IP address
Serial.println(WiFi.localIP());
}

void loop()

{

// 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 req = client.readStringUntil('\r');
Serial.println(req);
client.flush();

// Match the request
int val;
if (req.indexOf("/gpio/0") != -1)
val = 1;
else if (req.indexOf("/gpio/1") != -1)
val = 0;
else {
Serial.println("invalid request");
client.stop();
return;
}

// Set GPIO2 according to the request
digitalWrite(2, val);

client.flush();

// Prepare the response
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n\r\nGPIO is now ";
s += (val)?"high":"low";
s += "\n";

// Send the response to the client
client.print(s);
delay(1);
Serial.println("Client disonnected");

// The client will actually be disconnected
// when the function returns and 'client' object is detroyed

}

Hi guys
I'm currently working on a project that involves sending and receiving text via wifi. I'm using esp8266 01 for this. I've done my basic settings, everything seems cool with AT commands. I even used it as a webserver. But the problem lies in getting http get response. Whenever I receive anything with space and some characters, mt response will have + sign and some %c ....characters. I know they are the ascii equivalent of the sent characters. PLease guys, how may I remove those unwanted characters? I tried to use esp8266Wifi library, but installing it has never been successful, getting all sort of errors (like functional.h, queue.h, etc). Please guy assist me. Thanks

http response is usually url encoded. You need to url decode. Use this

Hi All,

I am having real problems access the AT commands.

I have the following set up between a nano and the ESP-8266:

GND------->GND
VCC-------->+3.3v
CH_PD---->+3.3v
TX--------->RX
RX--------->tx

I am using the flowing code as a serial through:

#include <SoftwareSerial.h>
SoftwareSerial softSerial(2, 3); // RX, TX

void setup() 
{
  uint32_t baud = 9600;
  Serial.begin(baud);
  softSerial.begin(baud);
  Serial.print("SETUP!! @");
  Serial.println(baud);
}

void loop() 
{
    while(softSerial.available() > 0) 
    {
      char a = softSerial.read();
      if(a == '\0')
        continue;
      if(a != '\r' && a != '\n' && (a < 32))
        continue;
      Serial.print(a);
    }
    
    while(Serial.available() > 0)
    {
      char a = Serial.read();
      Serial.write(a);
      softSerial.write(a);
    }
}

When i send AT the blue led flashes once very quickly on the ESP-8266 but i get no response back.

I have tried various baud rates but to no avail.

I have been searching for day on the web, but to no avail, anyone see what I am missing?

thanks in advance

JonMiles:
Hi All,

I am having real problems access the AT commands.

I have the following set up between a nano and the ESP-8266:

GND------->GND
VCC-------->+3.3v
CH_PD---->+3.3v
TX--------->RX
RX--------->tx

I am using the flowing code as a serial through:

#include <SoftwareSerial.h>

SoftwareSerial softSerial(2, 3); // RX, TX

void setup()
{
  uint32_t baud = 9600;
  Serial.begin(baud);
  softSerial.begin(baud);
  Serial.print("SETUP!! @");
  Serial.println(baud);
}

void loop()
{
    while(softSerial.available() > 0)
    {
      char a = softSerial.read();
      if(a == '\0')
        continue;
      if(a != '\r' && a != '\n' && (a < 32))
        continue;
      Serial.print(a);
    }
   
    while(Serial.available() > 0)
    {
      char a = Serial.read();
      Serial.write(a);
      softSerial.write(a);
    }
}




When i send AT the blue led flashes once very quickly on the ESP-8266 but i get no response back.

I have tried various baud rates but to no avail.

I have been searching for day on the web, but to no avail, anyone see what I am missing?

thanks in advance

Start your own thread so that your problem will get the attention it needs.

You shouldn't hijack someone else's thread.

I thought this was a thread all about the esp8266. It even says that in the first post.......

JonMiles:
I thought this was a thread all about the esp8266. It even says that in the first post.......

You'll notice that the other topics have nothing to do with your problem.

If you want your post to be noticed, create your own thread.

If you don't care, then that is fine too.

For AT Commands don't assume the logical approach of UNO TX to ESP RX... Try TX to TX and RX to RX.

Also understand contents of the following link: Send AT commands to ESP8266 from Arduino Uno via a SoftwareSerial port - Arduino Stack Exchange

Enjoy...

I have tried both TX to TX and TX to RX.

With TX to TX there is no blue led flash on the ESP8266. Also i am using softwareserial so not using the same tx and rx pins as the usb connection

Try 115200 baud instead of 9600.

Have tried that too. I have tried each of the baud rates at least once on the off chance.

I have the following set up between a nano and the ESP-8266:

VCC-------->+3.3v

If that's ESP8266 VCC to Nano 3.3V, be aware that the nano 3.3V regulator is not powerful enough to power an ESP8266.

If that's Nano VCC (5V!) to ESP8266 3.3V, that's just wrong and has probably fried your ESP.

westfw:
If that's ESP8266 VCC to Nano 3.3V, be aware that the nano 3.3V regulator is not powerful enough to power an ESP8266.

If that's Nano VCC (5V!) to ESP8266 3.3V, that's just wrong and has probably fried your ESP.

No, i had heard of those issues before. It id 3.3v external power. Not power from the nano. I have double checked and it is supplying 3.3v. We 3.28v but close enough.

Hi

can anyone help me with a "small" project?

i want to create an thermostat for an electrical heating control.

i found almost what i wanted in this code here: GitHub - mharizanov/ESP8266_Relay_Board: Three Channel WiFi Relay/Thermostat Board

the only thing missing is a push button that allows to override the normal target temp to something else for a set period of time

its intended for a flat where an autism person lives along with the care taking staff

the last group (staff) has a very bad habbit of messing with the panels and it tages ages to set the dials etc as the other flats give of heat too

my plan was using the firmware above and then if the staff should feel cold they can push a button to get extra heat for say 15 mins

Hello,

I'm working on a little IOT project, nothing complicated. I settled on the arduino system for my nodemcu cards because it was just more stable than trying to program them with Lua. I am minimally familiar with C++, but have some years of professional-level embedded programming experience in C.

Does anybody know how to get access to the sub-os world of the processor? I'm specifically talking about processor registers and physical memory. Even more specifically, at the moment, the stack pointer.

I'd like to apply a few simple tests to the stack pointer to help with reliability. I understand that the esp has
a small 4K stack. C, in general, is a stack-intensive language. 4K seems like enough for a little IOT project, but...

At the top of the main loop, the stack pointer should always be the same value. If it changes, it means that
somewhere, a push was not matched by a pop, or a call not matched by a return.

I'd like to set some words near the end of the stack to a magic number. If that number changes, we're close to blowing the stack.

The ideal thing would be a way to embed snippets of assembly language....

(This probably deserves to be a new topic.)

The ideal thing would be a way to embed snippets of assembly language....

esp8266 uses gcc, so it has the same sort of inline assembly language capabilities as all the other gcc variants.
The core CPU is a Tensilica Xtensa lx106 MCU, which you can find documentation for.

Note that the ESP8266 is a multi-tasking system, with the arduino-like loop() being one of the tasks. I would not be surprised if there were multiple stacks...

Hi:

I am trying to receive from a device that uses 802.11b protocol but not transmitting in standard WiFi channels/frequencies. Any idea if we could manipulate esp8266 or any standard WiFi cardto do so?

Ben

I just read this some days ago

I have some project with WS2811 led strip, running with FastLED library. Strip is controlling by D8 pin (ESP8266 ESP-12 Lolin). Everything is working fine, but since i have added analogWrite(...) to control brightness of on-board led (pin D4) - all effects are corrupted. What could be the problem? PWM on D4 is somehow related to bit-banging on D8? Common interrupts/timers? How to solve?