ESP8266

Hello I'm doing a project to recognize ssid of the model 5 esp8266, inside it has a menu with some bus lines would like to make a third button to call the string ssid cuff can help me

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//entrada dos pinos Digital Pwm

#define butUp 10 //Pino
#define butDown 9 //Pino
#define butSetar 8

int id ;

void changeMenu();
void dispMenu();

String SSAID ;

void SalvLiCent();
void CletCent();
void VillCamIICent();
void BenBentCentJaci();
void EusGCent();

// *** Variáveis Globais ***

String ssid [5];

ssid [0] = "{b2@U}"
ssid [1] = "{ac@U}"
ssid [2] = "{h82c0U}"
ssid [3] = "{B1AU0}"
ssid [4] = "{]02@U}"

char menu = 0x01;
char seta = 0x00;
boolean t_butUp, t_butDown, t_butSetar;

// --- Hardware do LCD ---
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

// *** Configurações Iniciais ***

void setup() {
lcd.begin(16, 2);

for (char i = 9; i < 13; i++) pinMode(i, INPUT_PULLUP);

t_butUp = 0x00;
t_butDown = 0x00;

}

// ** Loop Infinito ***
void loop() {

changeMenu();
dispMenu();

}

void espset {

while (true){

if (ESP.available()){
Serial.write(ESP.read());
}

if (Serial.available()){
ESP.write(Serial.read());
}
}

// *** Desenvolvimento das Funções Auxiliares ***

void changeMenu()
{

if (!digitalRead(butUp)) t_butUp = 0x01; //Botão up pressionado seta flag
if (!digitalRead(butDown)) t_butDown = 0x01; //Botão down pressionado seta flag

if (digitalRead(butUp) && t_butUp) //Botão up solto e flag setada
{
t_butUp = 0x00; //Limpa flag

lcd.clear(); //Limpa display
menu++; //Incrementa menu

if (menu > 0x05) menu = 0x01; //Se menu maior que 3, volta a ser 1

}

if (digitalRead(butDown) && t_butDown) //Botão Down solto e flag setada
{ //Sim...
t_butDown = 0x00; //Limpa flag

lcd.clear(); //Limpa display
menu--; //Decrementa menu

if (menu < 0x01) menu = 0x05; //Se menu menor que 1, volta a ser 3 (PODE ADD MAIS PAGINAS)

changeMenu();
dispMenu();

}

}

void dispMenu() //Mostra o menu atual
{

switch (menu)
{
case 0x01:
SalvLiCent();
break;

case 0x02:
CletCent();
break;

case 0x03:
VillCamIICent();
break;

case 0x04:
BenBentCentJaci();
break;

case 0x05:
EusGCent();
break;

}

SSAID = ssid [id];
pinMode(RST, OUTPUT);
digitalWrite(RST, LOW);
delay(300);
digitalWrite(RST, HIGH);

}

}

void SalvLiCent() //Linha Ponta verdade (menu1)
{
id = 0;
lcd.setCursor(0, 1);
lcd.print("SALVADOR LIRA/CENTRO");
lcd.scrollDisplayLeft();
delay(150);

}

void CletCent() //Linhda Cruz das almas (menu2)
{
id = 1;
lcd.setCursor(0, 1);
lcd.print("CLETO MARQUES LUZ/CENTRO");
lcd.scrollDisplayLeft();
delay(150);

}

void VillCamIICent() //Linhda Centro (menu3)
{
id = 2;
lcd.setCursor(0, 1);
lcd.print("VILLAGE CAMPESTRE II / CENTRO");
lcd.scrollDisplayLeft();
delay(150);

}

void BenBentCentJaci() {
id = 3;
lcd.setCursor(0, 1);
lcd.print("B. BENTES/CENTRO/JACINTINHO");
lcd.scrollDisplayLeft();
delay(150);

}

void EusGCent() {
id = 4;
lcd.setCursor(0, 1);
lcd.print("EUSTAQUIO GOMES/CENTRO");
lcd.scrollDisplayLeft();
delay(150);

}

void butSetar (){

if (!digitalRead (butSetar)) t_butSetar = 0x01;

if(digitalRead (butSetar) && t_butSetar){

t_butSetar = 0x00

seta ++;

if (seta > 2) sete = 0x01;

switch (seta){

case 0x01:
digitalWrite( SSAID [id], HIGH)
break;
}
}

}

Kindly follow the steps as given in the blog post..!
Hope it helps you..

http://hackshaders.blogspot.in/2017/05/how-to-blink-led-using-esp8266-arduino.html

Do you know a 8266 based module for linking two controllers via a serial bus? Wireless serial cable.

I am testing two ESP-01 modules but linking is difficult with them. What I know a web server and suitable request are needed. Something simpler for raw data would be enough.

Hello Guyz, I am working on ESP01 wifi project with Arduino IDE 1.8.2. but whenever i tried to work on ESP8266.h it gives me error like

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

Ive already install ESP8266 Generic Board.

Please give me advice. Thank you.

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...