I am trying to send a serial data from NodeMCU to Arduino. I use MicroPython to program. As well as Serial.read
on Arduino. I can send and receive successfully. But the problem is the NodeMCU sends data along with number which is not needed. And Arduino receives data along with number. For Example, if I send "Hello" it sends as "Hello5". I understood that the number is nothing but the number of alphabets in the string. How can I remove this?
MicroPython on NodeMCU:
import os
import machine
from machine import UART
uart = UART(0)
import time
while True:
uart.write('1')
Arduino program:
String received;
String msg;
void setup() {
Serial.begin(115200);
attachInterrupt(0, light, FALLING);//When arduino Pin 2 is FALLING from HIGH to LOW, run light procedure!
}
void light() {
Serial.println(msg);
}
void loop()
{
if (Serial.available() > 0){
received = Serial.readStringUntil('\n');
msg = received;
}
}