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

nrf51822 ble read the data send from smartphone

Hi all,

I am new to nRF51822,now I want to used a simple ble application to send a data,and nRF51822 ble device read this data to control RC servo motor ,for example app send value 1 then RC servo motor clockwise and send value 2 then RC servo motor counterclockwise,but i don't know how to read the data on nRF51822,can someone tell me how to do or provide sample code to me ?

Thanks in advance Peter.

Parents
  • Are you using the nRF51822 Evaluation Kit?

    I would recommend to start with the ble_app_uart example in the SDK. It has a corresponding android app which you can download the source code for here.

    In the UART example, in main.c there is a nus_data_handler function which you can modify to handle incoming data from the mobile app.

    You can then modify the mobile app so it has a button that sends the text "right", and in the handler function above you can check if p_data = "right" and then call a function which turns the motor to the right (you would have to write this function yourself, though. Try searching for PWM here on devzone, and you will find a lot of good answers)

Reply
  • Are you using the nRF51822 Evaluation Kit?

    I would recommend to start with the ble_app_uart example in the SDK. It has a corresponding android app which you can download the source code for here.

    In the UART example, in main.c there is a nus_data_handler function which you can modify to handle incoming data from the mobile app.

    You can then modify the mobile app so it has a button that sends the text "right", and in the handler function above you can check if p_data = "right" and then call a function which turns the motor to the right (you would have to write this function yourself, though. Try searching for PWM here on devzone, and you will find a lot of good answers)

Children
No Data
Related