Why would I want to write code for a theory?
Oh, maybe I shouldn't have started with;
I want to make a wireless Arduino controller to control some servos positions.
Anyways, I was wondering in theory if is could be done on a very simple, small scale, an example:http://arduino.cc/en/Tutorial/Knob
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
myservo.attach(9); // attaches the servo on pin 9 to the servo object
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
This isn't something anywhere near the stage of implementation, I am merely trying to get a feel of capabilities of the hardware. Theoretically speaking, if I could physically control something on one Arduino (potentiometer), and then have it relayed somehow (XBee) to another Arduino (Again XBee) and control a device that is interfaced to it (Servo).
This is only an example,
The potentiometer could be replaced with a button or anything else physical.
The servo could be replaced with anything as well.
The reason I chose an example with a potentiometer and servo is that it would show more accurately the precision of these devices working together in unison.
So this is possible? Also would it sound like it would be reasonable
to do with:
2x XBee (Series 1 is fine)
and of course the proper code.