Hi guys,
I am thinking about starting a really cool animatronic and my question is this:
I want to use one arduino to take readings from sensors and then use those values to determine what position servos should be in to mimic the movement. So I think the best way is to read the values using one arduino to read the sensor and send the servo position to the other arduino
The final lines being the determined servo positions.
Serial.print(servo1)
Serial.print(servo2)
Etc....
Then receive on the other Arduino and write to the servo
Servoangle1 = Serial.read() // this is reading the line sent from the other Arduino (Serial.print(servo1)
Servoangle2 = Serial.read()
Etc... Then:
servo1.write(Servoangle1)
servo2.write(Servoangle2)
Etc..
So to the question! First: does is code look vaguely along the right lines style wise. (Mainly, will the reciver read the serial.print statements in order so that the angles like Servoangle1 will be read in the right order?
Secondly: can the communication be done using this. https://www.arduino.cc/en/Tutorial/MasterWriter it seems like it would do the job.
Thanks very much, sorry if the questions are a bit confusing I'm struggling to convey things properly. I'd be happy to clarify anything
George