31 lines
679 B
C++
31 lines
679 B
C++
#include "grove_alphanumeric_display.h"
|
|
|
|
Seeed_Digital_Tube tube;
|
|
char tubeText[5] = "";
|
|
|
|
void initTube() {
|
|
// Wire initialized by BME280 sensor
|
|
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
|
tube.setBrightness(15);
|
|
tube.setBlinkRate(BLINK_OFF);
|
|
}
|
|
|
|
void updateTube() {
|
|
char newText[5];
|
|
bool highPoint = false, lowPoint = false;
|
|
|
|
if (countdown <= 0) {
|
|
sprintf(newText, "%4u", (unsigned int) (temperature * 100.0));
|
|
lowPoint = true;
|
|
} else {
|
|
sprintf(newText, "%4u", countdown);
|
|
}
|
|
|
|
if (strcmp(tubeText, newText)) {
|
|
strcpy(tubeText, newText);
|
|
tube.displayString(tubeText);
|
|
tube.setPoint(highPoint, lowPoint);
|
|
tube.display();
|
|
}
|
|
}
|