I'm trying to read my smart electricity meter' p1 port with a nodemcu. I know it uses serial communication and found tutorials on internet, and based my code on that. It didn't work so cropped my code until there was only serial.read left, and there was the problem.
So the problem is that there are still 20 lines to come but it always turns into question marks.
Is it because my arduino can't follow or something?
Or does the serial monitor slow everything down? Can fix it by storing the char's temporary?
yeah tried an available method too, but then it's the same without question markst
#include <SoftwareSerial.h>
SoftwareSerial mySerial(5, -1, true); // (RX, TX. inverted, buffer)
void setup() {
Serial.begin(115200);
mySerial.begin(115200);
}
void loop() {
if (mySerial.available()) { // If anything comes in Serial1 (pins 0 & 1)
Serial.write(mySerial.read()); // read it and send it out Serial (USB)
}
}
I don't believe you should require such elaboration. "Serial1" should be available, right out of the box. Go directly to the core documentation. Tutorials are fine but can lead you in wrong directions. https://docs.espressif.com/projects/arduino-esp32/en/latest/
That one is for ESP32 but you should find ESP8266 somewhere around there...