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
gefragt vor 2 Jahren239 Aufrufe
1 Antwort
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
EXPERTE
Greg_B
beantwortet vor 2 Jahren
  • 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?

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen