I am currently working on an arduino project which requires a pan and tilt. I have managed to get it to react in real time i.e by moving the joystick left or right the joystick moves along (and if you let go it goes back to neutral position) and where you can move it left or right and if you let go; it stays there!
My problem right now perhaps elementary, namely how can I use the built in analog joystick button to switch between the modes
Practically I suppose I can just make functions and tie them to the various modes (ie true = mode 1, false = mode 2) but how do I do it as the joystick button is a momentary switch - it only gives different values when pressed and held (actuated) or nothing. How can I make this a toggle switch?
Does anyone have any idea (what value does the SW pin even give?) or what to do or even better; sample code!