It works by subtracting the minimum value from the measured value which should give a number between 0 and 8. We then use two nested {{fname|for}} loops. The outer loop is for the {{fname|x}} axis and the two inner loops are for the {{fname|y}} axis. We use two loops here because we want to turn all the LEDs below the measurement red with {{fname|set_pixel}} and those above it off. That way the bar will appear to move up and down the y axis following the measured temperature.
+
Ce programme fonctionne par soustrayant la valeur minimale à la mesure de température. Cela produit un résultat entre 0 et 8. Nous utilisons ensuite deux boucles {{fname|for}} imbriquée pour l'affichage. La boucle externe pour l'axe des {{fname|x}} et axis and the two inner loops are for the {{fname|y}} axis. We use two loops here because we want to turn all the LEDs below the measurement red with {{fname|set_pixel}} and those above it off. That way the bar will appear to move up and down the y axis following the measured temperature.
Remember that you can use {{fname|sense.set_rotation(n)}} (where n is 0, 90, 180 or 270) at the start of the program just after {{fname|sense.clear()}} if you want to change the orientation of the bar.
Remember that you can use {{fname|sense.set_rotation(n)}} (where n is 0, 90, 180 or 270) at the start of the program just after {{fname|sense.clear()}} if you want to change the orientation of the bar.