Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
Accepted Solution

Can someone check the code, which has a wrong point.?

[ Edited ]

Tried to use buffer to collect acceleration, but fail.

Could anyone help me to debug??

 

if(paused==2){
                            for (i =0; i < 2; i++){
                                sensor_event_get_xyz(event, &force_x[i], &force_y[i], &force_z[i]);
                                if(force_x[0] != force_x[1]){
                                //if(tmb[0].millitm-tmb[1].millitm > 19){fail without data

                                    ftime(&tmb[i]);
                                    fprintf(f,"%ld%d, %7.3f, %7.3f, %7.3f\n", tmb[i].time, tmb[i].millitm, force_x[i], force_y[i], force_z[i]);
                                }
                            }

 

Thank you,

 

-Fight with BB10
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,690
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Can someone check the code, which has a wrong point.?

You are trying to read accelerometer data without checking if the data is ready (event occurred).  Have a look at the following link for an example.

 

Reading accelerometer forces

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Can someone check the code, which has a wrong point.?

Hi lyon819,

You have started multiple threads asking the same or similar questions (I just counted maybe 8 or 9 threads which only covered 2 or 3 questions).  Can you please try to direct your related questions to a thread you have already started?  Someone reading a question in one of your threads may not notice that it has already been answered in another thread.

 

Cheers,

Sean

Please use plain text.