PS3 Controller - 2 Brushless and a Servo

So... As the title says I am using a PS3 controller to control a hovercraft. I would like to use the Left Trigger for one of the Brushless motors, and the Right Trigger for the other. I would like to use the right joy stick for the servo (the rudder control).

Any and all help will be greatly appreciated. Happy Holidays!

Edit: Here is the code - Also check the second reply to this topic from me.

#include <PS3BT.h>                         //Include the necessary libraries.
#include <Servo.h>

USB Usb;
BTD Btd(&Usb);
PS3BT PS3(&Btd); 

Servo servo1; // ESC Number 1                                                        
Servo servo2; // ESC Number 2
Servo servo3; // Servo for Rudder Control

void setup() {
  Serial.begin(115200);                                              
  if (Usb.Init() == -1) {                                            
    Serial.print(F("\r\nOSC did not start"));
    while(1); //halt
  }
  Serial.print(F("\r\nPS3 Bluetooth Library Started"));              
  pinMode(3, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
servo3.attach(6);                                                                
servo1.attach(5);
servo2.attach(3) 
}
void loop() 
{
  Usb.Task();

  if(PS3.PS3Connected || PS3.PS3NavigationConnected) {
    
    servo1.write(map(PS3.getAnalogHat(RightHatX), 0, 255, 0, 180));
    servo2.write(map(PS3.getAnalogHat(LeftHatY), 0, 255, 180, 0));
    servo3.write(map(PS3.getAnalogHat(RightHatX),  ,   ,   ,   ));
  }
  else 
   {
    servo1.write(90);
    servo2.write(90);
    servo3.write(  );
   }
    
    if(PS3.getButtonClick(PS)) {
      PS3.disconnect();
   }
}

Edit: Posting the code I have momentarily.

Be sure to use the same time scale when expecting responses...

Up for help :slight_smile:

Where did you get the code? If you provide links it might help people help you.

Whenever I'm using a new controller, I make a simple program to display the data from the controller.

I suggest you display the data from the PS3 controller so you can see what values change as you manipulate the controls.

I'm not sure if I discussed this with you or not, but there are lots of game controllers which are easier to use with a microcontroller than the PS3.

I'm a fan of Wii Nunchucks myself. (I've used one to fly a RC helicopter.)

Also, great idea, bit of a newbie question, do I just pull up the serial monitor and press inputs on the controller to see the values, etc and match the value limits with the code?

You will also need to add Serial.print() statements to your code to print the data read from the inputs.