wiced sense taking the raw data without connecting to phone

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello Everybody

I include this code to wiced sense firmware code  ==

i16_t highCounter = 0;

#if WICED_SENSE_SUPPORT_ACCEL

/// Get the instantaneous accelerometer data.;

status_t wiced_sense_get_accelerometer_instantaneous_data(AxesRaw_t* dataA)                   ////////////////////////////////////  MY __ CODE

{

  axesCalData = &axesData;

  if (!ButtonPressed) return MEMS_ERROR;

  if(GetAccAxesRaw(dataA) == MEMS_SUCCESS)

  {

  if( ( ( axesCalData->AXIS_X - dataA->AXIS_X ) > 20 ) || ( ( axesCalData->AXIS_X - dataA->AXIS_X ) < -20 ) ||

  ( ( axesCalData->AXIS_Y - dataA->AXIS_Y ) > 20 ) || ( ( axesCalData->AXIS_Y - dataA->AXIS_Y ) < -20 ) ||

  ( ( axesCalData->AXIS_Z - dataA->AXIS_Z ) > 20 ) || ( ( axesCalData->AXIS_Z - dataA->AXIS_Z ) < -20 ) )

  {

  highCounter++ ;

  if( highCounter >= 30 )

  {

  wiced_sense_short_beep_buzzer(80);

  }

  }

  else

  {

  highCounter = 0;

  }

  return MEMS_SUCCESS;

  }

  return MEMS_ERROR;

}

#endif

As normal its only works while I connected my wiced sense to my phone because my code is in  #if WICED_SENSE_SUPPORT_ACCEL macro expansion

So my question is :  How can I change the way to use my code without connecting to my phone?

0 Likes
7 Replies
Anonymous
Not applicable

I am planing to make posture guard smart dress with using wiced sense

with this code I have axesCalData which is a pointer that when a user button is pressed its take the raw values of accelorometre to my CalData. So when there is a change between your calibration and the acceloremetre data the buzzer will turn on to give warning to user.

When I connected the wiced sense with my phone its working fine as I want.

But always turning the wiced sense app is not a good way for me to use.

Please show me the way that how I am gonna change the code for it

0 Likes
Anonymous
Not applicable

Hello.

This is because wiced_sense app only turns the sensors on when it is connected to another device, and powers down all the sensors when it disconnects.

In connection_up function:

pastedImage_0.png

In connection_down function:

pastedImage_1.png

Notice how in connection_up, wiced_sense_initialize_sensors is called,

and in connection_down, wiced_sense_power_down_sensors is called.

The way I see it, you have to options:

1. You can leave the original code as it is, and just call these functions when you need again. (although there might be unnecessary function overhead this way when you are already connected to a device)

2. Or you can comment out the lines in connection_up and connection_down functions shown above, and just turn the sensors on/off when you want. (e.g. turn the sensors in the wiced_sense_create function)

James

Anonymous
Not applicable

jamesle1​  Thank you very much I will try to both of them

0 Likes
Anonymous
Not applicable

jamesle1​ Hello again I tried the all ways you said but unfortunatelly My code is not working again.

First I tried to comment out the connection up and down function. What I did is I just simply add

return;

functions just under the connection up and down functions so before the connection statements the code turn back.Like this:

void wiced_sense_connection_up(void)

{

  return;

  wiced_sense_connection_handle = (UINT16)emconinfo_getConnHandle();

then I add the

wiced_sense_initialize_sensors();

function to in wiced_sense_create function. It didnt work for me.

Secodly I made a change in connection_up function

Simply I changed it like this :

void wiced_sense_connection_up(void)

{

  wiced_sense_initialize_sensors();

  return;

  wiced_sense_connection_handle = (UINT16)emconinfo_getConnHandle();

    // Initialize all sensors

  wiced_sense_initialize_sensors();

So I tried to initialize the sensor before connection_handle statement. It didnt work as well.

Finally I didnt change the original code and just add the

wiced_sense_initialize_sensors();

function before my code I write above  and It didnt work again.

I dont know what I need to do. I saw that when the first creation function and the all sensor initialize codes have ble_trace0 function has a string pointer which is in bleapp.h file

I dont know that maybe because of it I could not take the working code.

0 Likes
Anonymous
Not applicable

Still waiting to way out

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello.

I'm sorry about the late reply.

Are you still having this problem?

I had a project I worked on with wiced_sense before and I changed it to look a lot like what you are trying to do.

I'll attach it to this comment.

It turns the LED on and off if you shake the wiced_sense without any connections.

There is connection_up and connection_down, but they don't do anything.

There might be some variables that doesn't do anything, but I think the code is very simplified to understand.

To download, just copy paste the wiced_sense project, and instead of wiced_sense.c, use the file attached to make and download.

Please refer this example to get sensor data without connecting to phone.

If you still have problems, let me know.

James

lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

jamesle1​ Thank you very much for the example . The example is working fine yes withouth connection But I need also the connecction for my project because I am planing to make a logger with wiced sense than pass the data s to smart phone.

I attached the my main wiced sense.c code .

Could you please check it for me I tried everything but still could not find the true way to use the accoleremetre data s withouth connection.

0 Likes