Hello programmers, I am new to serial communication where I want to send integer values more than 5 digits and I am getting some fishy output.
expected output :
I send " 100000 " from the pi to the Arduino, expected output on the Arduino is also 100000
Connection: Arduino connected to pi via USB
I am adding the .ino and .py files and also the output.
arduino code:
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
String data = Serial.readStringUntil('\n');
Serial.print("You sent me: ");
Serial.println(data);
}
}
Python code form Raspberry pi:
#!/usr/bin/env python3
import serial
import time
i=100000
io=str(i)
if __name__ == '__main__':
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=1)
ser.flush()
while True:
ser.write(b"%s" %io)
line = ser.readline().decode('utf-8').rstrip()
print(line)
time.sleep(1)
please help me out

