Hey everyone! 8)
So lately I have began the acquisition of parts for my new project. An X style Quad-copter. I wanted to use an old PS2 controller to control the quad-copter which sounded simpler than it has proven to be. I have used Bill Porters PS2 interfacing library and sketch and I have successfully connected my PS2 controller to the Arduino Uno. I have serial readings and I am even able to modify the code to perform other simple tasks; For example, if the right arrow is pressed, Red LED High, Left arrow pressed LED Low. On the other hand, I have also gotten the MultiWii working and giving good YawPitRoll readings when connected to my MPU6050 GyroAccelro.
So separately, everything works, how can I combine everything?!
I can read analog inputs from the controller in the serial monitor in the format: (X,Y X,Y)
How can I manipulate these readings to control something like say my throttle input for my Quad-copter?
Now the PS2 controller does not actually use the Arduino's analog pins; instead the PS2 controller only uses 4 digital IO pins to read from the controller with full functionality. (Data, Sel, Clk, Cmd)
So because it does not use the analog pins, I cannot do an AnalogRead function..
This is my first question, how can I manipulate this code to OUTPUT the analog X,Y format to say Pin 2 which would be my throttle pin. I will attach the code being used to read the PS2 Joysticks to help you see what we're dealing with.
I like the idea of the PS2 controller because it has many channels(buttons) that can be programmed to do other things onboard the quadcopter such as activating different flight modes, or arming/disarming motors, or turning on the LED system and beepers.
Part 2:
Since the PS2 controller is not wireless, I purchased a few NRF24L01 Modules and I will be using a pair of these modules to create the 2.4Ghz transmit/rec between the PS2 controller and the other arduino (flight controller)So I estimate I need a minimum of 2 Arduino's
1 ) My Uno loaded with the PS2 Controller software, connected to the NRF
2 ) My Pro Mini & MPU6050 running Multiwii Software
Additional Info: Arduino Pin Out Used With MultiWii
D2 – Throtthle
D4 – Roll
D5 – Pitch
D6 – Yaw
How can I get the PS2 XY XY readings to OUTPUT to D2, D4, D5, D6.
Details (These are the parts I am using)
-Arduino Uno (Flight Controller Board)
-2xPro Mini (PS2 Controller Transmit/Rec Boards)
-MPU6050 Gyro&Accelro(Got it working with the Multiwii GUI)((THIS MPU WORKS GREAT DISPLAYS YAW/PIT/ROLL ON GUI! Shows quadcopter in corner of screen moving as I move the quad so it configured properly! 8)
-4x A2212 Motors (KV1000)
-4x 30A Esc
-2x NRF24L01 2.4Ghz Tx/Rx
-4x8045 Prop 2xCW 2xCCW
-11.1 2200mah Lipo
-F450 Quad Frame
-Other Common Accessories (16x2LCD, SPI TFT Displays, LEDs, Distance Sensor, Lasers, OV7670Camera) (if any of these acc are of use please let me know)
MultiWii.ino (619 Bytes)
PS2X_Example.ino (7.08 KB)