Hi , i am trying to merge ble_uart client example together with a project that I built using the app_pwm and uarte driver and I cant seem to manage is it possible to show me how and guide me please. i keep getting library issues and I'm getting lost
Hi , i am trying to merge ble_uart client example together with a project that I built using the app_pwm and uarte driver and I cant seem to manage is it possible to show me how and guide me please. i keep getting library issues and I'm getting lost
Hi Nikolai,
I made one example for you based on example nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_uart_pwm. Just release 3531.ble_app_uart_pwm.zip to the same folder.
Please pay attention to the following codes added to "nus_data_handler(ble_nus_evt_t * p_evt)". When you send "1" from the central device you will turn on PWM, send "0" will turn off PWM.
... NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length); switch (p_evt->params.rx_data.p_data[0]) { case '0': NRF_LOG_INFO("Turn off PWM"); pwm_stop(); break; case '1': NRF_LOG_INFO("Turn on PWM"); pwm_play(); break; default: // No implementation needed. break; } for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++) ...
Best regards,
Charlie
Thank you for your response, in my application I need to change the pwm frequency depending on the value entered through uart, can this be done as previously I was using the pwm library rather than the driver
Here is one example to use PWM library: ble_app_uart_pwm_library.zip
... NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length); uint32_t frz = (uint32_t) atoi(p_evt->params.rx_data.p_data); NRF_LOG_DEBUG("frz: %d",frz); app_pwm_int(frz); for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++) ...
Here is one example to use PWM library: ble_app_uart_pwm_library.zip
... NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length); uint32_t frz = (uint32_t) atoi(p_evt->params.rx_data.p_data); NRF_LOG_DEBUG("frz: %d",frz); app_pwm_int(frz); for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++) ...
thank uu ! ill have a look at it
hi i finally had a chance to look at this and wanted to thank you for the help, just wanted to ask how can I change this to a ble client rather than a ble peripheral as when i am trying to change the uart handler it doesn't seem to be wokring
Not sure what you mean, can you explain the "ble client" you want to change to?