Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By kalreg
#43252 I am not sure if it is a bug, but seems so to me.

I have ESP8266 connected to Arduino. ESP has uploaded arduino sketch.
Arduino reads continously button state - it sends to ESP 0 if button is released and 1 if button is pressed. If ESP gets data it sends back to arduino's Serial port for view. This lets me check if there is any data loss between Arduino and ESP. My code is far more complicated but mainly thats how it works in simple words. Now I'd expect on arduino if button is released something like:
0
0
0
0
0
0
0
0
0
0
0
0


but i get:

)0
†0
¤0
0
0
0
áHř0
0
0
0
˙*0
0
0
0
0
¤0
R0
)0
¤0
0

A lot of trash;(

Baud speed between ESP and arduino is 115200, but i also checked other speeds - no effect.

Code:
ESP:

Code: Select allvoid loop() {

  if ( client.available()) {
    String WiFiResponse = client.readStringUntil('\n');
    Serial.println(WiFiResponse);
  }

  if ( Serial.available()) {
    String SerialResponse = Serial.readStringUntil('\r\n');
   
    client.print(SerialResponse);
    Serial.print(SerialResponse);
   
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("Disconnecting from server.");
    client.stop();

    while(true);
  }
}


ARDUINO:

Code: Select all    int currentButtonValue = 0;
    for ( int i=0; i < numberOfButtons; i++) {
      currentButtonValue = currentButtonValue + int(buttonStatus[i] * (0.5 + pow(2, i)));
    }

      previousButtonStatus = currentButtonValue;
      Serial1.println(String(currentButtonValue));




Does anybody have idea why does it work that way?
User avatar
By somedude
#43412 I would make sure that both devices have the Serial initialized at the same rate, namely 115200, just to avoid problems. Since you seem to be getting the 0's I believe they are right.

Could the button be sending garbage? Try reading the button into a variable, then display that variable on the Arduino's serial monitor and compare with what you get on the ESP, at least you can narow it down to a button issue or a transmission issue.

Buttons can send noise too, they are not always on or off, there may be vibration in it and so on, maybe a cap would help if you do notice noise on the button.
User avatar
By Sobuj
#68009 Facing exact same problem. When Connecting via USB to Serial Converter or directly to Arduino Rx, Tx port then the port monitor is getting clean response. But when connecting to arduino GPIO port as SoftwareSerial, then receiving result with some random trash mixed with it.
Here is some result example:
Code: Select all⸮sl⸮⸮
Ai-Thinker Technology Co. Ltd.

rdady
AT
C⸮C⸮j⸮H⸮AT


OK
AT+GMR

AT veqsion:0.21.0/0
SDK vershon:0.9.5

OK
AT+GMR
AT versioo:0.21.0.0
SDK version;0.9.5

OK
AT+GMR

AT vfrsion:0.21/0.0
SDK vession:0.9.5

OK
AT+GMR

AT vession:0.21.0/0
SDK vershon:0.9.5

OK
AT+GMR

AT version:0.21.0.0
SFK version:0/9.5

OK

I am using a separate power supply with AMS1117 regulator. BAUD rate is 115200. Module is ESP8266 ESP-01 with AT Firmware. Tried with Arduino UNO, Pro Mini, Nano and got same result. Arduino Code is:
Code: Select all#include <SoftwareSerial.h>
SoftwareSerial Wifi(3,5);
void setup()
{
  Wifi.begin(115200);
  Serial.begin(115200);
}

void loop()
{
  if(Serial.available()){
    char input = Serial.read();
    Wifi.print(input);
  }
  if(Wifi.available()){
    char input = Wifi.read();
    Serial.print(input);
  }
 }

Just in case, I have also tried with different GPIO pins but no luck. :geek: