I'm making a project that will allow me to control a servo connected to an Arduino mega from a joystick that will be connected to another mega. Eventually the servo will have camera on it for video feed etc. The camera will be at one side of the room with the joystick at another.
So far when the joystick button is presses I can get the servo to do an automatic sweep function and this is on a timer so it will keep doing this. When the button is pressed again it well then receive manual command.
The trouble I'm now having is how do I now get control of the servos using the joystick that at the other end of the room on the sending Arduino? I'm doing this wired and it is likely it will stay that way. The camera has not been integrated yet, just trying to get the basics down first .
Any help would be great as I feel like I'm at a road block currently
The overall project is essential a remote camera that can be either doing an automatic sweep or controlled manually from another location.
We have 3 sensors that will be with the AL camera at one location and then a screen with the joystick at another.
Sensors will pick up noise or movement and the camera will pan to this location, with the AL function if it picks up a person it will set a buzzer off and then who ever is in the location where the buzzer is can manually then take control of the camera with a joystick
So I have them connected and can send a receive commands, I have it so that when I click the joystick and sweep is send the servo will do this, I can then click it again and it will send a manual command and stop the sweep command
where I'm stuck is when I'm now in manual mode how do I control the servo with the joystick when they are connected to different arduinos
The DroneBotWorkShop links have accompanying videos... so grab a full meal, start the videos, follow along in the text. Easier is not possible. Either of these methods involve connecting, configuring and programming the hardware.
Take a different approach! Make the structure of your message contain the status and position of every part of your project, rather than individual commands. On the command Arduino, change any one or more of the fields each time you make a physical change, such as a joystick. Send this structured message at a constant time interval.
On the receive/slave end, read each message and if one of the fields has changed from the previous message, make your component follow the new value.