#include <TM1637Display.h>
#define TEST_DELAY 2000
#define CLK 4
#define DIO 2
TM1637Display display(CLK, DIO);
void setup() {
// put your setup code here, to run once:
display.setBrightness(0x0f);
}
const uint8_t SEG_T[] = {
SEG_D | SEG_E | SEG_F | SEG_G, // t
0x0,
0x0,
0x0,
};
char CHARS[4] = {
0x0,
0x0,
0x0,
0x0 };
void loop() {
float temp = 15.6;
dtostrf(temp, 4, 1, CHARS);
Serial.print("t-dtostrf = ");
Serial.println(CHARS);
// shift the values
for(int i=0;i<=1;i++) {
CHARS[i+2] = display.encodeDigit(CHARS[i]);
}
CHARS[0] = SEG_T[0];
CHARS[1] = SEG_T[1];
Serial.print("shifted = ");
Serial.println(CHARS);
display.setSegments((const uint8_t*)CHARS);
delay(TEST_DELAY);
}