Go Down

Topic: Servo control (Read 1 time) previous topic - next topic

PeterH


It felt like the buffer was not completely cleared & the motor was turning against it's will . Some times it tries to rotate completely, but couldn't & the slow response is due to the delay's I used on both the boards.


I'm staring blankly at that and trying to figure out what on Earth it means. I can only guess there's some lag between your user interface input and the physical servo movement, which was already implied by your previous post, and I was hoping you'd say how much lag there was.

Do you know how fast that Processing code is sending positions to Arduino1? It's probably trying to send them a lot faster than your serial stream can deliver them, which means you'll have a backlog in the output stream which will delay any changes. You really need to limit the rate at which your processing code sends the position updates, to keep that well below the rate that the serial port can deliver them. One way to do that is to enforce a minimum interval between updates. Another way is to only send the new value if it differs from the previous value. Also take out all the delay() calls from your Arduino code. It might reduce the amount of data being passed to Arduino2 if you completely drain the incoming serial stream at Arduino1 and only send the final position over the wire to Arduino2.
I only provide help via the forum - please do not contact me for private consultancy.

dattasaurabh82

Though the delay's not much, it is noticeable.  Sorry if I was not able to convey the msg very clearly before . I tried, before you replied, with deleting all the delays in the Arduino code & that creates trouble definitely. So after 3 experimentation, I fixed the above given delays. Also I sorted out the sending of serial data to the com port from the applet by the your concept of - "Sending only the new values at some small 20ms delays", kind of solved the problem.

Go Up