Hi !
I am currently trying to develop an app that should act as a GamePad controller sending data (such as Joysticks and toggle switches) through BLE to an Arduino Uno r4 WiFi.
The app is working pretty good except regarding one point : when I start moving one Joystick in a circular motion without any "stops", the received data on the Serial Plotter are blocked to the last sent values until I stop rotating it.
Here is what I tried to troubleshoot the problem :
-
At first, I printed the values of the joysticks on the screen every 100ms to see if these values where blocked until I stop rotating, which is not the case : the values were correctly updated almost instantly.
-
Then, I tried to send fixed ramp values to see if the BLE module was "blocked" during the fast rotation of the joysticks, which was not the case : when moving the joysticks fast, it took a bit more time to receive the whole ramp, but it was still working.
-
After this, I told myself that maybe the "BLE.WriteBytes" function wants input data that are "stable" and so wait for the data to stabilise before sending it. To test this assumption, I created buffer variables that, every 100ms, take the values of the actual values. Even with this strategy, the problem kept persisting.
-
Finally, I tried to add a 100ms delay between the "BytesWritten" event and the "WriteBytes", such that the whole system has a bit more time to breathe and is not constantly sending data through BLE. Once again, it didn't fix the problem.
Here is a screenshot of my BLE callback :
I join aswell the whole aia file.
Arduino_GAMEPAD_v2 (1).aia (339.0 KB)
Thanks a lot for anyone taking time to read this post !