Problems with displaying the temperature on the STM32L4 Discovery Kit Board

0

So I started to modify the code for the MQTT of the freeRTOS so instead of it displaying "hello world!" on the terminal it will display the temperature from the board to the terminal. I have done this by writing a function called "tempDisplay()" as shown below: Enter image description here I then replaced all the "mqttexampleMESSAGE" with "tempDisplay()" as shown below: Enter image description here When debugging the program and displaying it on a terminal it just stops at line 19 as shown below, why is this? Enter image description here

Obinex
asked 2 years ago270 views
1 Answer
0

Hi Obinex. You have several problems with your C code. You have a warning at line 490 because tempDisplay() is not returning a value. Even if you added return str_tmp;, you'll still have problems because str_tmp is an automatic variable and will not be usable after tempDisplay() returns.

profile pictureAWS
EXPERT
Greg_B
answered 2 years ago
  • Hey Greg_B, thank you for the reply, I have changed line 482 in the first image from "static BaseType_T" to "const void *" and it rectified the warning although, I am still receiving the same result, what could be another course of action I can take?, what .c or .h files should I look at in the workspace or is that not necessary?

  • Have you implemented fixes for the two issues I mentioned? If your function still does not have a return statement, you will suffer undefined behaviour. Likely a bad pointer, hence the program crashes. Even if you fix that, if you don't fix the second thing I mentioned, you will return a pointer to an array that no longer exists, and hence you will publish junk.

    I'm not sure what your project is, but should you be continuing with C? Is it perhaps possible for you to complete your project by emulating a device using one of our other device SDKs? Python perhaps?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions