Skip to content

Serial.available() have a issue, its not able to return availiable bytes #9195

@The3ven

Description

@The3ven

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-07]
  • Core Version: [latest git hash or date]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Nodemcu v1.0 (ESP12E Module) ]
  • Flash Mode: [Not a Option]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [Not a Option]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

Nodemcu Serial.available(); function is not able to send total bytes available on serial it just send 1.

MCVE Sketch

#include "Arduino.h"

void setup()
{
    Serial.begin(9600);
}

String tmp = "";

void loop()
{
    while (Serial.available() > 0)
    {
        Serial.println("data in buffer : ");
        Serial.print(Serial.available());
        Serial.println("\n");
        tmp = Serial.readString();
    }

    if (tmp.length() > 4)
    {
        Serial.println("Data : " + tmp);
        Serial.println("Data length : " + String(tmp.length()));
        Serial.flush();
        tmp = "";
    }
}

Debug Messages

⸮R⸮⸮�⸮��⸮data in buffer : 
1

Data : hi hi hi

Data length : 10
⸮R⸮⸮�⸮⸮�R⸮⸮fgFj⸮data in buffer : 
1

Data : hihihih

Data length : 9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions