I want to read the acceleration sensor value using the example of the ble-hid-keyboard, but if I let you read the acceleration sensor value, Bluetooth will be cut off. Can we solve this problem?
I want to read the acceleration sensor value using the example of the ble-hid-keyboard, but if I let you read the acceleration sensor value, Bluetooth will be cut off. Can we solve this problem?
Hi,
Not easy to see from your code what is causing this issue. There can be many reasons that the Bluetooth connection is broken. Error codes, asserts, priority issues, etc.
Does the chip reset? Are you seeing any error codes on the log? Have you tried debugging the application to see where it fails?
If you can post the full application project, it may be easier to see/test what is causing the issue.
Best regards,
Jørgen
In the code you posted, all calls to functions reading the accelerometer seems to be commented out. Can you post the code showing exactly where you call this code?
In the code you posted, all calls to functions reading the accelerometer seems to be commented out. Can you post the code showing exactly where you call this code?
for (;;)
{
idle_state_handle();
CalibAccel();
calcDT();
calcAccelYPR();
calcGyroYPR();
calcFilteredYPR();
nrf_delay_ms(50);
}
}
I want the idle and the functions below to run in series and run in parallel at the same time. Is this what you want?
If you put the code like that, CalibAccel/calcDT/calcAccelYPR/calcGyroYPR/calcFilteredYPR/nrf_delay_ms(50) will be called every time the chip wakes from sleep to perform a task. If you have any sources in your application that will wake the chip from sleep (timers, etc), this should work. If there are no wakeup sources, the application will go to sleep and stay there forever. In general, it is a better approach to do the function-calls in a timer event if you want to do a regular read of the sensor. Alternatively, you can set a flag in the timer event handler, and read the sensor in main-loop if the flag is set.
thank you!!! how to work the program through timer event?? have you simple example??? It's hard to apply because I'm a beginner.ㅜㅜ
Please have a look at the Application Timer Tutorial.