Hey everyone, I’m working on a project that has a motor attached to a pot(pot 2) for positional feedback, and a pot (pot 1) that will be the reference for the position of the motor. So what I want to happen, is if I rotate pot 1 to half way it will turn the motor, adjusting pot 2, either forward or backwards, to the position of pot 1. Here comes the tricky part, I want to do it all wirelessly with a Xbee and instead of using 1 reference pot controlling 1 motor, I want 5 pots controlling the position of 5 motors. All I want to know right now is, is it possible and how do I go about doing it, I want to make a sort of pseudo code for it.
Attached is a graphical drawing to help understand. The drawing only contains 1 reference pot, 1 feedback pot, and 1 motor.
Here is what I understand for what my code needs to do.
- Read in the value of all 5 reference pots on an analog in pin and store them as variables on arduino 1.
- Somehow send those variables through Xbee 1 to Xbee 2 and store them as variables on Arduino 2.
- Read in the value of all 5 positional pots on an analog in pin and store them as variables on arduino 2.
- Write an If/else chain that loops for each motor that compares the reference pots to the positional pots and making a digital output pin on arduino 2 to go high or low for forward or backwards on the specific motor. I would use two pins for each motor.
If someone could help me figure out how to send the values of the pots from arduino 1 to arduino 2 and be stored as a variable would be very helpful, and please let me know if anything could be done in an easier way.