Hi I'm using nRF5 SDK for mesh. with DK PCA10040.
I want to read the temperature sensor reading on button press. Please give me guidelines on implementing this.
Thank you.
Hi I'm using nRF5 SDK for mesh. with DK PCA10040.
I want to read the temperature sensor reading on button press. Please give me guidelines on implementing this.
Thank you.
In the nRF5 SDK (non-mesh), the BSP provides events on button press - is that not available in the mesh version?
If it isn't, then look at how the non-mesh SDK does it ...
I tried the following
static void button_event_handler(uint32_t button_number)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);
switch (button_number)
{
/* Pressing SW1 on the Development Kit will result in LED state to toggle and trigger
the STATUS message to inform client about the state change. This is a demonstration of
state change publication due to local event. */
// Read Temperature Sensor
case 2:
{
_ __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Temperature \n" );
uint32_t temperature;
sd_temp_get(&temperature);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Temperature is = %d \n" , temperature/4);
break;
}
default:
break;
}
}
this gives the temperature of the board and prints on the RTT Viewer
It seems that you have figured this out. Do you want to read the temperature on the nrf52 or on your own temperature sensor that you hook up to the dev kit?
Hi Bjørn Kvaale,
I want to read the temperature of nrf52. like, when i press the button on client, the server should respond with blinking light and giving its temperature and print on client's rtt viewer. please help me out where i need to make necessary changes.
Ok, have you figured out how to press the button on the light switch client example & get the temperature of the board on the client? Now, instead of doing this, you want to press a button on the client, which will then make the server blink it's LED & send an Acknowledgement with the temperature of the server, correct? You could send a reliable unicast message to achieve this. Have I understood the question correctly?
yeah you are right. I'm able to press the button on client and get client's temperature. but i need server's temperature.
lets not make this too complicated lets consider one provisioner, one client and one server for now.
I would do something similar to my latest comment here.
I would do something similar to my latest comment here.