-
Notifications
You must be signed in to change notification settings - Fork 793
Description
Hi,
I'm using your PS4BT library for robotics, and it's very great !
Now I'm trying to make a program that allows to switch from hard pairing to soft pairing without uploading a new software. To do this, I need to read a value (digital pin set to 1 or 0) before the creation of PS4BT to know if the "pair" parameter is to set to 1 or 0, thus creating the PS4BT object in the setup() function.
To keep the global knowledge of PS4, I declare a global pointer,
PS4BT* pPS4;
and then do a
pPS4 = new PS4BT(&Btd,pair);
in the setup() function, and then use pPS4->getButtonClick(...).
But when I do this, the remote controller pairs with the Arduino (hard or soft depending on the switch) and immediatly lose the connexion. If I stay with plain object declared as global for PS4BT, I need to change the pairing mode in the source code, but then the connexion works perfectly.
Do you have an idea of why this does not work ?
Thanks in advance