# Oled e sensore temperatura

**URL:** <https://forum.arduino.cc/t/oled-e-sensore-temperatura/1205338>\
**Category:** Software\
**Created:** [December 30, 2023, 3:37pm UTC](https://forum.arduino.cc/t/oled-e-sensore-temperatura/1205338 "2023-12-30T15:37:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Datman](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/datman/32/219519_2.png) [@Datman](https://forum.arduino.cc/u/Datman)\
**Post date:** [December 31, 2023, 9:49pm UTC](https://forum.arduino.cc/t/oled-e-sensore-temperatura/1205338/3 "2023-12-31T21:49:56Z")

</div>

Quei delay() bloccano tutto! Fai:

```arduino
uint32_t t_lettura;

loop:
// ...
if (millis()-t_lettura>499) // Una volta ogni 500ms.
  {
  t_lettura=millis();
  leggi();
  disp();
  }

```

e tutto ciò che rimane sempre uguale scrivilo solo una volta nel setup(). Per cancellare i valori precedenti, salvali e riscrivili in nero un attimo prima di scrivere i valori aggiornati. Ho fatto così nel magnetometro:

> [@Magnetometro (gaussmetro) AC/DC](https://forum.arduino.cc/t/magnetometro-gaussmetro-ac-dc/1100262):
>
> Ciao a tutti Ciao, @Etemenanki Vorrei realizzare un magnetometro (strumento di misura) per flussi variabili. Ho trovato questo: The key feature of the code is that the magnetic field is measured 2000 times in a row. This takes about 0.2-0.3 seconds. By keeping track of the sum and of the squared sum of the measurements, it is possible to calculate both the mean and the standard deviation, which are reported as DC and AC. By averaging a large number of measurements, the precision increases, …

---

_[View the full topic](https://forum.arduino.cc/t/oled-e-sensore-temperatura/1205338)._
