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();
}
}