Problem with Serial communication between Arduino and Python

Hi!

I've been doing a project of Ball Beam Balancing Problem in Arduino. I am using servo and eFLL libraries as a tools to implement fuzzy logic as a controller to servo. The script in python sends coordinates of a ball using pyserial library.

As I am trying to debug the code, python script sends the coordinates to Arduino, the Arduino sends back the coordinates as a confirmation of data recieved. While working with the Arduino Uno board, the back and forth communication lasts between 20 to 60 seconds, then no data is recieved by a Python script. Thought it might be something with computation power or memory overload, so I switched to Arduino Mega. On Mega there are no data recieved in python script (yes i changed the COM port)

It could be a case of memory fragmentation. Perhaps you can try to replace the following lines,

with:

    x = Serial.parseFloat();
    Serial.read();  // Discard '\n'.

Otherwise, the problem is likely in a part of the code that was not shared.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.