Readout

Print Numbers over UART Exercise

Task

A freezer's service console shows its probe. Print the reading from the given read_temp() once, as one line in degrees with two decimals:

read_temp() console 2305 T:23.05 -50 T:-0.50

The registers and bit fields are on the Datasheet tab.

Circuit

Block diagram: U2, a temperature probe, feeds U1 STM32F4, where the given read_temp() returns its reading in hundredths of a degree; your code turns it into text for USART1, which sends it on PA9 to the service console

Pass condition

Your line must match the expected one. Readings run from -40.00 to 125.00, and each test stores its own.

Expected output for the two public cases: read_temp() returns 2305 and the console shows the line T:23.05; it returns -50 and the console shows the line T:-0.50

Notes

read_temp() returns hundredths of a degree. The given code sets up USART1. printf works but lacks floating point. Your program is built and run at -O0, then again at -O2. Both must pass.

Related challenges

Loading the interactive arena.