Ill cut right to the chase.
I have a arduino that reads some serial data and then transforms it into servo data(i.e. it uses several pins instantiated as servos to send the data) to another arduino. My question is: What is the minimum delay I have to put into the code to not overwhelm the other arduino? Is there such a thing or I can just write out the information as it arrives?(have no delay in my sketch).
Thanks!
Oh and the second arduino(not the one receiving the serial data) runs at about 3000 cycles per second. I don't know if it affects something but its extra information.
Wouldn't it be more efficient to send the data to the second Arduino without converting it to Servo data? Do the conversion on the second Arduino where it will be used?
Probably but you misunderstood me. The second arduino serial port is used by another program(not mine) and sending the data through that way has been tricky and resulted in problems. So, I am sending the serial information from the first arduino to the second one through "servo pins". The first arduino receives some serial data and then sends "servo" commands to the second arduino which interpretes and uses them.
Without actually looking at the servo library, I'm going to guess that it makes no difference how fast you're setting the servos to position. The library has to send the signal frequently (every 20mS?) so I suspect that your new data will be used the next time it's time to send, unless you overwrite it before that.
Theelectronicguy:
What is the minimum delay I have to put into the code to not overwhelm the other arduino? Is there such a thing or I can just write out the information as it arrives?(have no delay in my sketch).
It will take up to 20ms for your new output value to reach the wire, plus however long it takes your other Arduino to get around to reading the input, plus up to another 20ms for it to read the input once. Given that the timing of a servo pulse is not a very precise way to send an analog value, you might want to have the receiver average it over several pulses, meaning several more multiples of 20 ms. If you update the output faster than the receiver is capable of reliably reading it, you risk lost data. In any case it's unlikely that the received value will be exactly what was sent, so I hope you don't mind if the data gets altered slightly along the way.
This is a pretty bizarre communication method and I can't imagine why you would prefer this over a simple serial connection.