This sample shows how to use a temperature sensor with a Raspberry Pi to collect sensor data and send to Azure IoT Hub. It also shows how to control an LED connected to the GPIO pins using Azure Device Twins.
This is explained in this YouTube playlist:
https://www.youtube.com/watch?v=-wZETf98E6U&list=PLGi0uFHAUvEG0vYbBe_8U3K1LYsa4CNUk