Home > Arduino, Bluetooth, TKJ Electronics, USB > PS3 Controller BT Library for Arduino

PS3 Controller BT Library for Arduino

I just finished porting the bluetooth library to Arduino. It’s based on the library for the USB Host Shield from Circuits@Home. It works exactly the same way as the class for the boards from GHIElectronics – FEZ Panda, FEZ Rhino etc. You should check out my other post, if you haven’t already: FEZ Panda & PS3 Controller, FEZ Panda & PS3 Controller via Bluetooth, and Demonstration of the PS3 Controllers in action.
To make it work, you’ll need a USB Host Shield or an Arduino ADK.

Update
I have now created another library that only supports the controller via USB. The source code for the USB library can be found at the github repository. An example can be found as well: PS3USB.ino.

Video Demonstration

The library can be found at our Github: https://github.com/felis/USB_Host_Shield_2.0. You should also see the Github wiki for more details.

Categories: Arduino, Bluetooth, TKJ Electronics, USB Tags:
  1. tony
    July 6th, 2015 at 21:48 | #1

    Hi, has the library got a function of button release? Or hat release? As hat analogs never return to 128 centre when released they can be random depending how hard you release the trigger

    Thanks

  2. July 6th, 2015 at 22:18 | #2

    @tony
    To check if a button is pressed simply use the function getButtonPress: http://felis.github.io/USB_Host_Shield_2.0/class_p_s3_b_t.html#a5e7842bef25e7c7210974f5405e1bc81.

    The hat should return back to 128? Are you using an official controller?

  3. tony
    July 6th, 2015 at 22:45 | #3

    @Kristian Lauszus
    Hi

    I am using official controller but it is about 5 years old now, get buttonpressed is ok, i can send out command but i need it to then send another command when i release the button.

    E.g ptz camera, button left press, moves left but it seems like when you press it just knows it was pressed not held, then released, then i send stop command to camera

    Thanks

  4. July 6th, 2015 at 23:01 | #4

    @tony
    You can implement that logic yourself. Simply hold the state in a static variable and then check if it just went from pressed to released.

    I am not sure what you mean? I sounds like you are using getButtonClick where you should be using getButtonPress?

  5. tony
    July 6th, 2015 at 23:15 | #5

    Sorry i ment buttonclick, i have tried getbuttonpress but that is analog and same as hat the button never returns to 0 when i release, its always a random analog value. I am new to coding and not sure hos to implement the static variable.

    I was looking at the ps2 library and it has a buttonrelease statement, can i add one to the ps3 lib?

    Thanks again

  6. July 6th, 2015 at 23:18 | #6

    @tony
    No getButtonPress returns a bool: http://felis.github.io/USB_Host_Shield_2.0/class_p_s3_b_t.html#a5e7842bef25e7c7210974f5405e1bc81.

    What PS2 library are you talking about? You can check if a button is released like so:

    if (!PS3.getButtonPress(CROSS)) {
       // Button is released
    }
  7. tony
    July 7th, 2015 at 07:08 | #7

    Hi, this is the ps2 https://github.com/madsci1016/Arduino-PS2X/blob/master/PS2X_lib/PS2X_lib.h

    Thanks for your help i will try your solution

  8. tony
    July 7th, 2015 at 21:04 | #8

    hi I tied your solution but it does not work,

    if (!PS3.getAnalogHat(LeftHatY)){
    }

    doesn’t output until then hat is fully forward, as 0 is fully forward.

    if (!PS3.getButtonPress(CROSS)) {
    // Button is released
    }

    does not output anything, can I send you my code please to make sure iam not making a mistake

  9. July 7th, 2015 at 21:28 | #9

    @tony
    You should not check the analog hat that way, then the statement will only become true when the joystick reads 0. What are you trying to archive? If you want to check if it is in the center, then do something like this:

    if (PS3.getAnalogHat(LeftHatY) < 137 && PS3.getAnalogHat(LeftHatY) > 117) {
    }

    The second code should be true every time you release the button. Did you actually try to print anything or how did you check if the code where run or not? Share your code somewhere and I will take a look.

  10. tony
    July 7th, 2015 at 22:05 | #10

    hi

    http://codeviewer.org/view/code:5315

    is my code,
    ok so under the button click left, I have modified this now because I have added a buttonreleased but what is happening. I press button left it outputs my code but then I get the stop command straight away, it doesn’t output the stop when I depress the button.

    thanks

  11. July 11th, 2015 at 12:01 | #11

    @tony
    First of all you are missing brackets after:

    if (PS3.PS3Connected || PS3.PS3NavigationConnected)

    You can only leave them out if there is only one line after the statement! Also a single ‘&’ is used as a bitwise operator and you should use two i.e. ‘&&’ for the the AND operator. Please read: https://www.arduino.cc/en/Reference/BitwiseAnd.

    Sorry it is hard for me to figure out what is wrong in your code when I can’t see the source code for your getButtonReleased function.

  12. tony
    July 12th, 2015 at 16:08 | #12

    @Kristian Lauszus
    thanks Kristian, I have since redone my code and have it working, thanks for your help. although Its not the best method, I had to use a lot of serial ends and serial begins.

    http://codeviewer.org/view/code:533c

  13. July 12th, 2015 at 17:15 | #13

    @tony
    You should begin and end the serial communication like that. I believe you can solve your problem with the flush command: https://www.arduino.cc/en/serial/flush.

  14. Gaston
    July 18th, 2015 at 03:43 | #14

    Hi @Kristian Lauszus

    I’m also experiencing the same connectivity issue as Marvin posted on June 22nd, 2015.

    PS3 Bluetooth Library Started
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 5C:F3:70:67:FF:A0
    Wait For Incoming Connection Request
    Dualshock 3 Controller Connected
    Bluetooth Address was set to: 5C:F3:70:67:FF:A0
    PS3 Bluetooth Library Started
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 5C:F3:70:67:FF:A0
    Wait For Incoming Connection Request
    Gamepad is connecting
    Incoming Connection Request
    Remote Name: PLAYSTA

    After this, On the PS3 Controller the four LED’s are blinking for around 1 minute, but no connection.
    I’m working with an Arduino UNO and the Circuits@Home USB Host Shield rev. 2.0.1
    and Original PS3 Controller Dualshock 3 Sixaxis.

    I’ve also tried with 2 different “listed” BT dongles
    Exactly the same behavior with both dongles,

    Could you please provide me with some ideas?

    Thanks

  15. Gaston
    July 18th, 2015 at 08:24 | #15

    @Gaston
    @Kristian Lauszus

    Nevermind, I just got it running now,
    The issue was an old version of the Arduino IDE software

    Maybe you can help me to explain,
    When I google Arduino IDE the first hit sends me to:
    https://www.arduino.cc/en/Main/Software
    There I can download the “latest” version which is ARDUINO 1.6.5

    Now, if you go to http://www.arduino.org/downloads
    There you can download a later version Arduino 1.7.6

    I have installed that newer version and the connectivity issue is gone,

    How is it possible to have 2 different sites to download the IDE software!!!???

    I will appreciate your comments,

    Thanks

    Gaston

  16. July 18th, 2015 at 08:31 | #16

    @Gaston
    This issue was solved just recently: https://github.com/felis/USB_Host_Shield_2.0/pull/168.

    You should download the IDE from arduino.cc, the arduino.org has basically copied them and claimed that they are the folks behind Arduino. You can read more about it here: http://hackaday.com/2015/02/25/arduino-v-arduino/.

    I know it version number says 1.7.6, but the code is much older than 1.6.5. Again you can read some more information here: http://hackaday.com/2015/04/06/arduino-ide-forked/.

  17. Avilash sahoo
    July 31st, 2015 at 09:09 | #17

    @Kristian Lauszus

    sir please help i want to connect ps3 controller to usb host shield by bluetooth. i have tried with 3 different Bluetooth dongle and two of them were supported and conformed working by diiferent users from internet. one the Chinese one used here and one was kinivq BTD-400 and one was Leoxsys Bluetooth 4.0 USB 2.0/3.0 Adapter Dongle: 2.1+EDR Compliant. all of them are edr supported. but all shows

    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 5C:F3:70:67:3F:58
    Wait For Incoming Connection Request
    Keyboard is connecting
    Incoming Connection Request
    Remote Name: PLAYSTA
    Connected to Device: 00:26:5C:4F:4D:00
    HID Control Incoming Connection Request
    HID Control Successfully Configured
    HID Interrupt Incoming Connection Request
    HID Interrupt Successfully Configured
    Wait For Incoming Connection Request
    Dualshock 3 Controller Enabled
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 1
    …….
    I am using a keyes host shield usb uno and mega. ps3 controller working well with usb connector but when i connect using bluetooth dongle and corresponding code its giving above results.
    what to do please help

  18. August 3rd, 2015 at 00:18 | #18

    @Avilash sahoo
    Please use the official shield, as there is all kind of weird issues with clones. You can buy it either from us: http://shop.tkjelectronics.dk/ or here: https://www.circuitsathome.com/products-page/arduino-shields.

    The problem you are facing is due to your dongle not supporting 2.0+EDR. Please see: https://github.com/felis/USB_Host_Shield_2.0#faq. Here is a list of confirmed working dongles: https://github.com/felis/USB_Host_Shield_2.0/wiki/Bluetooth-dongles.

  19. Anadika
    April 2nd, 2016 at 17:23 | #19

    Hi, after uploading the PS3BT example (without changing settings.h debugging), I only get the following message in the serial monitor: “PS3 Bluetooth Library Started”
    It does not go beyond that. Could you please advise on how to solve this issue? Thanks in advance.

  20. Anadika
    April 6th, 2016 at 19:46 | #20

    @Lauszus
    Hey, I need some help. In the serial monitor, I’m stuck at ‘PS3 Bluetooth Library Started’. I went through the comments and according to the suggestions, did the following:
    -- Uncommented L20 and L21 in PS3BT.cpp file (no change, I still was stuck at the same message)
    -- Changed debug from 0 to 1 in settings.h file (got a whole bunch of compilation errors)

    PS3BT.ino: In function ‘void loop()’:
    PS3BT.ino:55:31: error: no matching function for call to ‘PS3BT::getAnalogButton(Button)’
    PS3BT.ino:55:31: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: uint8_t PS3BT::getAnalogButton(AnalogButton)
    uint8_t getAnalogButton(AnalogButton a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: no known conversion for argument 1 from ‘Button’ to ‘AnalogButton’
    PS3BT.ino:55:58: error: no matching function for call to ‘PS3BT::getAnalogButton(Button)’
    PS3BT.ino:55:58: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: uint8_t PS3BT::getAnalogButton(AnalogButton)
    uint8_t getAnalogButton(AnalogButton a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: no known conversion for argument 1 from ‘Button’ to ‘AnalogButton’
    PS3BT.ino:57:42: error: no matching function for call to ‘PS3BT::getAnalogButton(Button)’
    PS3BT.ino:57:42: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: uint8_t PS3BT::getAnalogButton(AnalogButton)
    uint8_t getAnalogButton(AnalogButton a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: no known conversion for argument 1 from ‘Button’ to ‘AnalogButton’
    PS3BT.ino:60:44: error: no matching function for call to ‘PS3BT::getAnalogButton(Button)’
    PS3BT.ino:60:44: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: uint8_t PS3BT::getAnalogButton(AnalogButton)
    uint8_t getAnalogButton(AnalogButton a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:80:13: note: no known conversion for argument 1 from ‘Button’ to ‘AnalogButton’
    PS3BT.ino:85:25: error: no matching function for call to ‘PS3BT::setLedOff()’
    PS3BT.ino:85:25: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: void PS3BT::setLedOff(LED)
    void setLedOff(LED a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: candidate expects 1 argument, 0 provided
    PS3BT.ino:92:25: error: no matching function for call to ‘PS3BT::setLedOff()’
    PS3BT.ino:92:25: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: void PS3BT::setLedOff(LED)
    void setLedOff(LED a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: candidate expects 1 argument, 0 provided
    PS3BT.ino:99:25: error: no matching function for call to ‘PS3BT::setLedOff()’
    PS3BT.ino:99:25: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: void PS3BT::setLedOff(LED)
    void setLedOff(LED a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: candidate expects 1 argument, 0 provided
    PS3BT.ino:106:25: error: no matching function for call to ‘PS3BT::setLedOff()’
    PS3BT.ino:106:25: note: candidate is:
    In file included from PS3BT.ino:7:0:
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: void PS3BT::setLedOff(LED)
    void setLedOff(LED a);
    ^
    /Users/BAGHEL/Documents/Arduino/libraries/USB_Host_Shield_Library/PS3BT.h:94:10: note: candidate expects 1 argument, 0 provided
    PS3BT.ino:122:13: error: ‘class PS3BT’ has no member named ‘printStatusString’
    Error compiling.

    Can you please advice? Thanks a lot!

  21. jonnys
    April 11th, 2016 at 11:28 | #21

    Hi kristian, i just begin to use your ps3 library for Arduino and i wanted to thank you for this awesome job, we really appreciate it!

    I started with PS3BT and everything worked well, but i wanted also to add the PS3USB so i can use one of them each time without to have to upload the sketch every time. I tried to see if PS3Multi does this function but what i’ve understand it’s that that need just to use multiple controllers at the same time, right? tell me that i’m wrong 😀

  22. Johnson Nguyen
    April 12th, 2016 at 04:35 | #22

    Hi Kristian,

    I need some help with my code using the USB host shield 2.0! I’m trying to use my PS3 controller to turn on an RGB bulb at a specified color by press either CROSS, SQUARE, TRIANGLE, or CIRCLE. But I’ve only been able to get the RGB to turn on momentarily or as long as I pressed the button. I want the RGB to stay on until another color is selected or it is shut off. It should also be noted that I am using a common anode RGB. My code so far is as such:

    #include

    USB Usb;
    BTD Btd(&Usb);
    PS3BT PS3(&Btd);
    int redPin = 6;
    int greenPin = 5;
    int bluePin = 3;

    #define COMMON_ANODE

    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(redPin, OUTPUT);
    pinMode(greenPin, OUTPUT);
    pinMode(bluePin, OUTPUT);
    }

    void loop()
    {
    Usb.Task();
    if(PS3.getButtonPress(CROSS)){
    moveSetBulb(0, 0, 255); // red
    }
    else if(PS3.getButtonPress(CIRCLE)){
    moveSetBulb(0, 255, 0); // green
    }
    else if(PS3.getButtonPress(SQUARE)){
    moveSetBulb(255, 255, 0); // aqua
    }
    else if(PS3.getButtonPress(TRIANGLE)){
    moveSetBulb(335, 0, 335); // purple
    }
    else{
    moveSetBulb(0, 0, 0);
    }
    if(PS3.getButtonClick(PS)) {
    PS3.disconnect();
    }
    }

    void moveSetBulb(int red, int green, int blue)
    {
    #ifdef COMMON_ANODE
    red = 255 -- red;
    green = 255 -- green;
    blue = 255 -- blue;
    #endif
    analogWrite(redPin, red);
    analogWrite(greenPin, green);
    analogWrite(bluePin, blue);
    }

  23. April 14th, 2016 at 23:06 | #23

    @Anadika
    There was a issue in the library that cause it to fail compiling when the serial debugging where turned on: https://github.com/felis/USB_Host_Shield_2.0/commit/8f3faf2bb86e090cec99601c06a7beb28d159c6c and https://github.com/felis/USB_Host_Shield_2.0/commit/00397199706b1c1f4029f78f0bd6f3ab2ef08e3f. Please download the newest code from Github and try again.

    @jonnys
    Yes PS3Multi is meant for using multiple controllers at the same time.

    You can simply create two instances:

    PS3USB PS3_USB(&Usb);
    PS3BT PS3_BT(&Btd);

    And then use the provided function in order to read the buttons etc.

    @Johnson Nguyen
    Simply use the “getButtonClick” function instead.

  24. jonnys
    April 21st, 2016 at 16:11 | #24

    Thank Lauszus for your reply,
    I try as you told me, it worked but i had almost to duplicate every if()
    I created the two instances as:
    PS3USB PS3_USB(&Usb);
    PS3BT PS3_BT(&Btd);

    But to use the same function to read the buttons like:

    if (PS3.getButtonClick(UP)) {
    how i can call it one time but for both instance BT and USB?
    it’s correct to call it in this way?
    if (PS3_USB.getButtonClick(UP)) || (PS3_BT.getButtonClick(UP)) {

    And to assign it to a value like in this way, how i can add the PS3_BT ?
    Servo1 = map(PS3_USB.getAnalogHat(LeftHatX), 0, 255, 0, 180);

  25. jonnys
    April 24th, 2016 at 23:42 | #25

    Ah, another thing Kristian,
    I’ve noticed that if i add a delay maybe 50ms and over in the loop, the controller seems can’t connect to the usb host shield till i change it at maximum to 10ms or remove it completely, it is normal?

  26. April 25th, 2016 at 19:20 | #26
  27. Johnson Nguyen
    April 28th, 2016 at 22:23 | #27

    @Kristian

    Thanks for the repy. But I’ve tried that and it only turns on the RGB LED for a split second before it shuts back off. I want to keep the LED on until it is shut off.

  28. April 28th, 2016 at 22:52 | #28

    @Johnson Nguyen
    Simply just remove:

    else {
        moveSetBulb(0, 0, 0);
    }

    And then just do:

    if (PS3.getButtonClick(PS)) {
        moveSetBulb(0, 0, 0);
        PS3.disconnect();
    }
  29. Ryan
    April 29th, 2016 at 02:04 | #29

    Hi Kristian,
    I am using the circuits@home USB shield, an arduino mega 2560, and an approved, tested dongle purchased from TKJ. I am using the example sketch PS3BT to attempt to connect, and have mixed results so far. I have had it connect a couple of times, but when I attempt to reconnect, it will not connect. When I push the ps button to reconnect, with the sketch running on a separate power supply, the lights on the controller just blink and it won’t connect. I have tried to upload the sketch with debug information turned on, but just get an error.

  30. Ryan
    April 29th, 2016 at 02:07 | #30

    @Ryan
    I forgot to mention that I have tried connecting with a PS4 controller as well, and it will not connect at all. The USB dongle does not show up as available if I scan with my phone, though I’m not sure if that matters.

  31. Bruno
    April 30th, 2016 at 20:45 | #31

    Hello Lauszus,

    Should it work with unofficial ps3 controllers? I tested two dongles, they get recognised but can’t connect to the controller. The four leds just keep blinking.

    thank you!

  32. May 6th, 2016 at 16:00 | #32

    @Ryan
    Please upload the code with debugging enabled again. There were a bug which I have now corrected.

    There is mixed results with unofficial controllers. I would recommend sticking with an official PS3 controller.

  33. Ryan
    June 6th, 2016 at 00:17 | #33

    I’ve been trying to get my PS3 controller to connect with my Arduino boards for a while now, and have had mixed success. My setup is an Arduino Mega 2560 with an official USB host shield and a tested Bluetooth dongle purchased from tkj electronics. The controllers that I am trying to connect are official Sony 6 axis controllers, though they are fairly old. I use an external power source to power the Arduino board while trying to connect, too. I have had the controllers connect 3 times total out of approximately 40 attempts. Each time it connected, it would never reconnect. I have finally been able to get debugging data, and I was hoping you might be able to help me figure out my problem. I have a program on my computer called Sixaxis pair tool that reads the Bluetooth address of the controller, and it verifies that the Arduino sketch is writing the address of the dongle to the controller, but it still won’t connect. I have included the debug data and the top part of the sketch. The rest of the sketch is unchanged, it came from the example library, it is the PS3BT example. So, here is the Bluetooth address part of the sketch, and the debug data is attached as a text file. Of course, as I am typing this email, I finally managed to get it to connect again, so I have included that inn the debug file, too.

    Thanks,
    Ryan

    /*
    Example sketch for the PS3 Bluetooth library -- developed by Kristian Lauszus
    For more information visit my blog: http://blog.tkjelectronics.dk/ or
    send me an e-mail: kristianl@tkjelectronics.com
    */

    #include
    #include

    // Satisfy the IDE, which needs to see the include statment in the ino too.
    #ifdef dobogusinclude
    #include
    #include
    #endif

    USB Usb;
    //USBHub Hub1(&Usb); // Some dongles have a hub inside

    BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
    /* You can create the instance of the class in two ways */
    //PS3BT PS3(&Btd); // This will just create the instance
    PS3BT PS3(&Btd, 0x00, 0x11, 0x22, 0x98, 0x76, 0x54); // This will also store the bluetooth address -- this can be obtained from the dongle when running the sketch

    Here’s the debug data-

    PS3 Bluetooth Library Started
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:11:22:98:76:54
    Wait For Incoming Connection Request
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Dualshock 3 Controller Connected
    Bluetooth Address was set to: 00:11:22:98:76:54
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Dualshock 3 Controller Connected
    Bluetooth Address was set to: 00:11:22:98:76:54
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:11:22:98:76:54
    Wait For Incoming Connection Request
    Gamepad is connecting
    Class of device: 00 05 08
    Incoming Connection Request
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10
    Connection Failed: 10

    Connection Failed: 10
    Connection Failed: 10
    Gamepad is connecting
    Class of device: 00 05 08
    Wait For Incoming Connection Request
    Connection Failed: 10
    Connection Failed: 10

    Here is a successful attempt.

    PS3 Bluetooth Library Started
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:11:22:98:76:54
    Wait For Incoming Connection Request
    Gamepad is connecting
    Class of device: 00 05 08
    Incoming Connection Request
    Remote Name: PLAYSTATION(R)3 Controller
    Connection established
    Connected to Device: 00:21:4F:9B:B4:33
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    HID Control Incoming Connection Request
    Connection established
    HID Control Successfully Configured
    HID Interrupt Incoming Connection Request
    HID Interrupt Successfully Configured
    Wait For Incoming Connection Request
    Dualshock 3 Controller Enabled

    LeftHatX: 124 LeftHatY: 123 RightHatX: 140 RightHatY: 131
    LeftHatX: 124 LeftHatY: 123 RightHatX: 140 RightHatY: 132
    LeftHatX: 124 LeftHatY: 123 RightHatX: 140 RightHatY: 132
    LeftHatX: 124 LeftHatY: 123 RightHatX: 140 RightHatY: 132
    LeftHatX: 124 LeftHatY: 123 RightHatX: 140 RightHatY: 132
    LeftHatX: 124 LeftHatY: 123 RightHatX:

  34. June 22nd, 2016 at 13:53 | #34

    Hi Kristian,
    I have a problem when I connect ps3 dualshock controller to arduino mega 2560,In the serial monitor, I get stuck at ‘PS3 Bluetooth Library Started’. & ps3 dualshock’s all leds start blinking it doesn’t connect.

  35. June 24th, 2016 at 09:05 | #35
  36. July 13th, 2016 at 22:31 | #36

    @Kristian Sloth Lauszus
    I’ve checked with Debugging enabled but it’s the same problem, it doesn’t connect with the Dual shock.

    It worked fine first but then when I re-programed it later it doesn’t connect and gave me error “OSC didn’t start”, then I searched for the solution which told to edit the macro in settings.h #define USE_UHS_MEGA_ADK from 0 to 1.

    It started working then and gave the output “PS3 Bluetooth Library Started” but it doesn’t connect with the Dual shock.

    Do you know why it doesn’t connect or any solution to the problem.

  37. July 13th, 2016 at 23:18 | #37

    @Usama
    What shield are you using?

  38. Nixx
    March 25th, 2017 at 12:31 | #38

    @Kristian Sloth Lauszus
    Hello Kristian,
    My PS3 controller cannot pair with BT dongle. The 4 LEDs were blinking for around 1 min and then all went off.

    Below are messages from serial monitor.

    PS3 Bluetooth Library Started
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:15:83:0C:BF:EB
    Wait For Incoming Connection Request
    Keyboard is connecting
    Class of device: 00 05 40
    Incoming Connection Request
    Remote Name: PLAYSTATION(R)3Conteroller-PAN
    Connection established
    Connected to Device: 04:F2:78:70:63:25
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    //[continue very long]

    Wait For Incoming Connection Request
    HCI Disconnected from Device
    Wait For Incoming Connection Request

    Could you please advise?

Comment pages
1 4 5 6 1955
  1. No trackbacks yet.