Closed The3ven closed 2 months ago
Nodemcu Serial.available(); function is not able to send total bytes available on serial it just send 1.
Serial.available();
#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 = ""; } }
⸮R⸮⸮⸮⸮data in buffer : 1 Data : hi hi hi Data length : 10 ⸮R⸮⸮⸮⸮R⸮⸮fgFj⸮data in buffer : 1 Data : hihihih Data length : 9
function is not able to send total bytes available on serial it just send 1.
does exactly what you have asked, though? tmp = readString() replaces the whole string, perhaps you meant +=
tmp = readString()
+=
Basic Infos
Platform
Settings in IDE
Problem Description
Nodemcu
Serial.available();
function is not able to send total bytes available on serial it just send 1.MCVE Sketch
Debug Messages