FYI The website https://www.mysensors.org/ is a good resource for sample Arduino code relating to working with various sensors.