#include <TM1637TinyDisplay.h>
void mostraTemp(float);
float T=27.755;
float T1=17.723;
float T2=7.755;
float T3=7.723;
#define CLK 3
#define DIO 4
// Create the C Symbol
const uint8_t C[] = {
SEG_A | SEG_D | SEG_E | SEG_F
};
TM1637Display display(CLK, DIO);
void setup()
{
Serial.begin(9600);
mostraTemp(T);
delay(2000);
mostraTemp(T1);
delay(2000);
mostraTemp(T2);
delay(2000);
mostraTemp(T3);
}
void loop()
{
}
void mostraTemp(float T)
{
// prepara cifre da mostrare
int a; // parte intera 1 o 2 cifre
int b; // parte decimale 1 cifra
if (T>= 10.0) {
a = int(T) % 100;
}
else
{
a = int(T) % 10;
}
b = (int((T=T+0.05)*10)) % 10;
// attiva display
display.clear();
if (T>= 10.0) {
display.showNumberDec(a, false, 2, 0);
}
else
{
display.showNumberDec(a, false, 1, 1);
}
display.setSegments(C, 1, 3);
}