This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to integrate Beacon Transmitter Sample application with Push button function

Hi all,

I am new to nrf51-dk and I am using nRF5 SDK v11.0.0. I wanted to perform the task below.

When the DK is turned ON, read on board push button status.
If button is pressed, 
      advertise data packed A
else 
      advertise data packet B.

As of now, i am able to turn on and off led's based on push button by making use of the example program "Pin Change Interrupt Example". Also, using "Beacon Transmitter Sample Application" program, i am able to transmit (advertise) some data packets.

But, i couldn't integrate the programs together as I am not familiar with interrupts and this platform.

Is there any online program or tutorials where i can learn to do this? It's quite urgent and it would be of great help if anyone can help me

Thank You :)

Parents
  • Hi.

    You are nearly there! All you need to do is to add a function call to change your advertising when pushing the button.

    err_code = ble_advdata_set(&advdata, NULL);
    

    Before you call this function, change the advdata variable to include what you want.

    See the advertising tutorial for a more info on advertising.

  • Hi,

    Many thanks. I had managed to change the advertisement data (major and minor values) based on the push button input.Now, I wanted to scan the advertised data from nearby nrf51-dk and if the data (UUID, major and minor values) matches, i need to light up an on-board LED. I understand we need to use this function

     err_code = sd_ble_gap_scan_start(&m_scan_param);
    

    where m_scan_param is defined as follows static const ble_gap_scan_params_t m_scan_param = { SCAN_REQUEST, SCAN_WHITELIST_ONLY, NULL, (uint16_t)SCAN_INTERVAL, (uint16_t)SCAN_WINDOW, SCAN_TIMEOUT };

    Am wondering how this function will return the scanned data advertised by the nearby beacon. Could you please advise me on this how to read the scanned data and manipulate on it?

Reply
  • Hi,

    Many thanks. I had managed to change the advertisement data (major and minor values) based on the push button input.Now, I wanted to scan the advertised data from nearby nrf51-dk and if the data (UUID, major and minor values) matches, i need to light up an on-board LED. I understand we need to use this function

     err_code = sd_ble_gap_scan_start(&m_scan_param);
    

    where m_scan_param is defined as follows static const ble_gap_scan_params_t m_scan_param = { SCAN_REQUEST, SCAN_WHITELIST_ONLY, NULL, (uint16_t)SCAN_INTERVAL, (uint16_t)SCAN_WINDOW, SCAN_TIMEOUT };

    Am wondering how this function will return the scanned data advertised by the nearby beacon. Could you please advise me on this how to read the scanned data and manipulate on it?

Children
No Data
Related