My team is planning to have a partner joystick with tank control and a regular joystick with arcade. The tank drive will be used for precise aiming. But, when we try to drive only the partner joystick works, and we figured that they are just interfering with each other. Is there a way to use a button to switch between the 2 joysticks?
I am using EasyC V4 and I need to switch between my primary and secondary controller somehow. The drive is not working because we have driving programmed on both controllers
arcade to drive around
tank to precisely aim
One possible way to do what you want(I think at least) would be something like:
if absolute values of controller 1 > a threshold
then use arcade
else if absolute values of controller 2 > a threshold
then use tank
else
then stop the drive
Can you attach a screenshot of your current code? I don’t have an easyC license but have used it a lot in the past.
The best way to do it is going to be rather than a button to switch modes is we are going to switch to the partner joystick if and only if the main joystick is roughly in the middle.
We are going to save the right joysticks vertical and horizontal channels to variables. (make sure this is inside of the loop)
Then
if(abs(vertical)<10 and abs(horizontal)<10)
then
tank block
else
arcade block
I honestly have no idea how to program it but thins is what i have (has not been tried yet) I have my variables set to 1 but don’t know if this is correct.