#include <TM1637Display.h>
#include "max6675.h"
int termoCLK = 9;
int termoSO = 11;
int termoCS = 10;
#define CLK 13
#define DIO 12
int BTN = 2;
MAX6675 thermocouple(termoCLK, termoSO, termoCS);
TM1637Display display = TM1637Display(CLK, DIO);
const uint8_t celsius[] = {
// SEG_A | SEG_D | SEG_E | SEG_F // C
SEG_A | SEG_C | SEG_D | SEG_F | SEG_G // S
};
void setup() {
display.clear();
display.setBrightness(10);
Serial.begin(115200);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(BTN, INPUT);
}
void loop() {
int tem = analogRead(A0);
int set = analogRead(A1);
int BTNS = digitalRead(BTN);
if (thermocouple.readCelsius() < set){
Serial.println("ON");
} else {
Serial.println("OFF");
}
Serial.println(set);
if (BTNS == HIGH){
display.showNumberDec(set);
display.setSegments(celsius, 1, 4);
delay(200);
display.clear();
}else{
Serial.println(thermocouple.readCelsius());
display.showNumberDec(thermocouple.readCelsius());
delay(80);
display.clear();
}
}