Temperatur sensor function fails with timer, works fine in loop

Assuming they work like interrupts then any global variables you are setting inside the interrupt and reading outside it in the loop, or in your publishTemp function might need to be declared volatile, see:

EMBED WITH ELLIOT: THE VOLATILE KEYWORD

2 Likes