Здравствуйте, подскажите как сделать вывод температуры на TM1637 без сотых. А то на данный момент выводится с сотыми и если температура более сотни, то первой цифры нет. Желательно чтобы они были прижаты к правому краю.
PHP код:
#include "max6675.h"
#include "TM1637.h"
#define CLKKL 6
#define DIOKL 7
int thermoDO = 2; //он же SO
int thermoCS = 3;
int thermoCLK = 4; //он же SCK
TM1637 tm1637KL(CLKKL, DIOKL);
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
void KLLCD() {
float tempSensorKOL(thermocouple.readCelsius());
int8_t Digits[] = {0x00, 0x00, 0x00, 0x00};
int KL1 = tempSensorKOL;
int KL2 = (tempSensorKOL - KL1) * 100;
if (KL1 > 99)(KL1 = tempSensorKOL - 100);
//tm1637KL.point(POINT_ON);
Digits[0] = (KL1 / 10); // раскидываем 4-значное число на цифры
Digits[1] = (KL1 % 10);
Digits[2] = (KL2 / 10);
Digits[3] = (KL2 % 10);
tm1637KL.display(Digits);
}
void setup() {
tm1637KL.init();
tm1637KL.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
Serial.begin(9600);
}
void loop() {
KLLCD();
//Выводим показания в монитор порта
Serial.print("C = ");
Serial.print(thermocouple.readCelsius());
delay(1000);
}