Python - Arduino Serial Communication with NewLine

On the python side how i send data;

for x in xrange(0, 512, 32): ser.write(str(x/32 + 1) + "\n") on Arduino how i read the data;

if (incomingByte == "1\n") { digitalWrite(A0, HIGH); } Problem is Arduino can not recognize the data with "\n". If i open serial monitor in "newline" mode and write "1", Arduino catches it. But(!) if i write "1\n" in "no line ending" mode, again Arduino can not recognize it. What could be the problem Thanks.

It can. The escape version "\n" doesn't work with the serial monitor. I put the incoming bytes into an array, then when it receives the '\n', processes the array. I'm watching it work as I type this. It is exactly the algorithm I use with a GPS module.

This Python - Arduino demo may give you some ideas. And you may wish to look at Serial Input Basics which was written more recently.