Here you can have a look at an example project: GitHub - maxgerhardt/pio-stm32-with-esp8266-dht11: A simple demo in which a STM32 reads a DHT11 temperature sensor and the ESP8266 transmits it to the ThingSpeak.