Serial Communication works only when serial monitor is active

Hi guys,

i have following problem. I have an Arduino Nano with some simple sensors. Im writing the sensor data to the serial port. And im reading it with a simple python skript. However the communication only works if i activate the "serial monitor" in the arduino IDE. Any suggestions why this is the case ?

Best regards,
Mark

Since you have not posted any of the code you are using all I can do is suggest you look at this Python - Arduino demo

...R

Okay heres some of my code, i thought it is not needed, because it is actually very simple:

Arduino Code:
in loop:

int sensorValueL = analogRead(A5);
int sensorValueR = analogRead(A6);
Serial.print(sensorValueL); //Write the value of the photoresistor to the serial monitor.
Serial.print(","); //Write the value of the photoresistor to the serial monitor.
Serial.print(sensorValueR); //Write the value of the photoresistor to the serial monitor.
Serial.print("\n");

and on the python side i try to read it this way:

#Only once
import serial
ser = serial.Serial('/dev/ttyUSB0', 9600)

#in loop:
values = ser.readline()

Do some processing here.


Kisle:
Okay heres some of my code,

Please post complete programs.

Did you study the code in my link and compare it to your own?

...R