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

NRF_LOG_INFO how to print log with string parameter

If I receive some string from BLE and I want to log it to RTT how do I do it?

I tried this:

char str[] = "NameX";
NRF_LOG_INFO("dev nm: %s",str);

but it can not be compiled - error is:

......\main.c(1455): error: #167: argument of type "char *" is incompatible with parameter of type "uint32_t"

I assume there shale be something simple how to log string...

Parents
  • just cast to (uint32_t):

    NRF_LOG_INFO("dev nm: %s",(uint32_t)str);
    
  • FormerMember
    0 FormerMember in reply to ben38

    Another option is to use a pointer:

    char *p_my_text = "Testing string";
    	NRF_LOG_INFO(" %s \r\n", (uint32_t)p_my_text);
    
Reply
  • FormerMember
    0 FormerMember in reply to ben38

    Another option is to use a pointer:

    char *p_my_text = "Testing string";
    	NRF_LOG_INFO(" %s \r\n", (uint32_t)p_my_text);
    
Children
No Data