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
已提問 2 年前檢視次數 239 次
1 個回答
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
專家
Greg_B
已回答 2 年前
  • 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?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南