Hi, does anyone know how to make a button press in the program instead of manually press it from the kit?
thanks!
Hi, does anyone know how to make a button press in the program instead of manually press it from the kit?
thanks!
What is your aim here?
Couldn't you just call the code that your button press handler calls when you detect a button press?
If you look at the example nRF5_SDK_15.3.0_59ac345\example\ble_app_uart the data byte only sent when you press the button, but I want it to be sent automatically.
Thanks
Okay. Your original question wasn't clear at all and now I'm more confused.
Maybe I'm looking at a different version of the example that you refer to, but I couldn't see where a button press on the development kit causes anything to be sent either over the UART or the BLE.
Are you wanting data sent over the UART or the BLE automatically and from where e.g. phone app -> BLE->nRF52->UART->PC, or PC->UART->nRF52->BLE->phone app?
Are you just wanting data to be sent from the nRF52 over the UART?
You can set Nordic nRF Connect Tool to remember data sent so that you can just load it and send it otherwise you'll need an app of some sort.
You'll have to use a Terminal emulator or write a program of your own to send data automatically over the serial link from the PC.
Nordic always come with the example such that
where I want to get grid of the button press to wake up and advertise how can I do it ? I want to advertise automatically instead of a button pressed.
For instance,
static void sleep_mode_enter(void) { uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE); APP_ERROR_CHECK(err_code); // Prepare wakeup buttons. err_code = bsp_btn_ble_sleep_mode_prepare(); APP_ERROR_CHECK(err_code); // Go to system-off mode (this function will not return; wakeup will cause a reset). err_code = sd_power_system_off(); APP_ERROR_CHECK(err_code); }
Thanks,
bluey
You don't have to use the button support package as it is, and indeed you can switch the unit to advertising automatically.
Have a look at the BLE peripheral blink example, it will automatically advertise on start-up.
If you leave any example code to enter sleep (to save power) how are you going to wake the system up?
You will need to look at more than one example and take from them the parts of code that you need to get the programme that you want. The examples are just that, an indication of how you can perform small bits of functionality.
On the most basic level as a rule hard inputs e.g. UARTs or GPIOs have handler code that then performs an action based on what is received. You can write your own functions to perform that. To start with I would suggest writing those functions and then calling them from the code already in the example.
So if you are trying to send data over a UART automatically you may want to trigger that using a timer. Test the code first by calling it from a button press handler, then when you add the timer you can call the same code on the timer event.
With the Bluetooth you will need to decide what services and characteristics you are going to use, or indeed if you want to use custom ones and add the code to do so.
I'd advise you to not change any of the Nordic Bluetooth library or service code, just add you're own interface code that calls the bits that you need.
where I want to get grid of the button press to wake up and advertise how can I do it ?
As cbd suggested in the first reply, You look at what code gets called when the button is pressed - and just do that!
This is the standard approach to adapting any software to your specific needs - nothing specifically to do with Nordic or even embedded ...
where I want to get grid of the button press to wake up and advertise how can I do it ?
As cbd suggested in the first reply, You look at what code gets called when the button is pressed - and just do that!
This is the standard approach to adapting any software to your specific needs - nothing specifically to do with Nordic or even embedded ...