-
Notifications
You must be signed in to change notification settings - Fork 781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using USB Host Shield to connect (via a Bluetooth Dongle) with mini Gamepad bluetooth controler #321
Comments
@jkoenig72 if it support Bluetooth HID, then it is already supported: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/BTHID/BTHID.ino. |
Thanks. I use this one. Btw. great work! A few ideas: I would like to define a fixed Bluetooth address for the controller. Best would be directly in the BTHID.ino. Also - any example of the gamepad parser? For now a very simple one would do it, based on the keyboard parser but simply pass through all hex values in some array. Ideal I need to include the new class in the BTHID so I can do the Motor control from there. Just parse through all events from the controller. Some events get triggered with the mouse parser 0x01, some with 0x02 and some with 0x03. How I can get them all handled in one new parser, gamepad parser? Thanks! |
When I switch debug info on I can see all events showing up in the log - L2CAP Interrupt: A1 02 00 07 07 00 X1: 00 Y1: 07 X2: 07 Y2: 00 Rz: 00 What would help is a really simple parser that allow me to have that data in the level of the main BTHID.ino file Any way to do so? /Joerg |
This one here points me to the right direction: https://blog.tkjelectronics.dk/2013/12/bluetooth-hid-devices-now-supported-by-the-usb-host-library/ Seems that the PS4BT example works mostly OOTB with a 4.0 BT Dongle and all those mini gamepads. Thanks for this work you did - love it! |
Minor issue - it only pairs when I have the PIN in the code. PS4BT PS4(&Btd, PAIR); When I use (after successfully paired 1st time) it shows: Any idea? |
I can confirm that this is working simply by using the PS4BT example. |
@jkoenig72 sorry, but you last comment is a bit unclear. Does it work or not with the PS4BT example? From the previous comment is sounds like it does not work when in "non-paring" mode. |
Sorry - yes, it was unclear: it only works with PS4BT PS4(&Btd, PAIR); When I use (after successfully paired 1st time) PS4BT PS4(&Btd); It does not work. However as I plan to use it wioth fixed BT address this is ok for me - I always use the pairing mode. If connection get lost its important that the motor slowly goes down in speed and in case of reconnecting I can place a reset button outside the case. Now I run into another issue - I have mapped all keys of the BT controller nicely to a switch statement in loop() - however when I try to add the servo library it works but with seconds of delay, guess thats to some interrupt conflict. Any idea how I can control an ESC (for the motor speed control) with that - normally servo lib is good for that and easy to use - you pass values between 800 and 200 as speed into esc.writeMicroseconds(speed); But seems that both servo lib and USB host libs does not work well together. Any other way of controlling an ESC? Regards My current code (ESC commented out) - /* #include <PS4BT.h> // Satisfy the IDE, which needs to see the include statment in the ino too. // Controller BT address USB Usb; /* You can create the instance of the PS4BT class in two ways */ // controller vars int speed = 800; boolean ready = false; unsigned long previousTime; // functions & procedures bool printAngle, printTouch; void setup() // esc.attach(10); #if !defined(MIPSEL) if (Usb.Init() == -1) { previousTime = millis(); } if (PS4.connected())
} |
Found the information that pins 9 through 13 used by default. Changed to 7 now - works! |
Hello!
I understand that you changed the function BTD () |
Hi,
just wondering. Doing e-skateboard right now. I was thinking it could be a good idea to use those cheap Bluetooth mini game pads, cost around 4$ and very small.
USB Shield <-> USB Bluetooth Dongle <-> Mini game pad
They seems to support Bluetooth 3.0.
Like
https://www.aliexpress.com/item/New-4-in1-Mini-Wireless-Portable-Bluetooth-Remote-Gamepad-Game-Controller-Joystick-For-Samsung-Gear-VR/32815681614.html?spm=2114.search0104.3.1.k865Tb&ws_ab_test=searchweb0_0,searchweb201602_2_10152_10065_10151_10068_10344_10342_10343_10340_10341_10193_10194_10304_10307_10060_10302_10155_10154_10056_10055_10054_5370015_10059_10534_10533_10532_100031_10099_10338_10339_10103_10102_10052_10053_10107_10050_10142_10051_10320_10321_10322_10084_10083_10080_10082_10081_10177_10110_5590015_10111_10112_10113_10114_10180_10312_10313_10314_10184_10319_10078_10079_10073_10186,searchweb201603_30,ppcSwitch_7&btsid=693121df-3886-44cb-9a6d-95ef2a8128b4&algo_expid=301d85b6-9353-407f-a998-7e5a69db0eee-0&algo_pvid=301d85b6-9353-407f-a998-7e5a69db0eee
Any idea how to do that?
The text was updated successfully, but these errors were encountered: