Unable to receive correct data from serial

xmarkx:
I have to ask. When I open a serial from my python script arduino reset? I mean it will run again setup() function etc...?

Yes.

You could have written a short program to test that and discovered the answer far more quickly than asking a question here. The Arduino system is great for learning-by-doing.

...R

I have made some tests with LEDS. As a result when I open Serial Monitor and then run my python script it is working. But when I just run the python script at boot it is not working and the problem is not at the arduino but at the serial communication. I have attached 3 LED at 3 specific points on my code. The first led is activated when any serial data comes, the second when i recognize a command and the 3rd when i execute the command. I have seen that no LED is active when I run my python script and type a command. For some reason arduino is not receiving data from the serial. This is quite strange for me because with the exact same code as soon as i open a serial monitor everything is running perfectly.

I would appreciate any ideas or test proposals. I am sure there are others against this problem.

thank you for your time.

Have you tried setting DTR and/or RTS in your Python code as I suggested in Reply #16?

...R

I think i have solved this. You have to open serial at the start and keep it open. If you close it and open it again something is not working properly.

xmarkx:
I think i have solved this. You have to open serial at the start and keep it open. If you close it and open it again something is not working properly.

I mentioned that in Reply #16

...R