Move temp to led conversion into separate function