Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h> //inclui LCD
- #include "max6675.h" //inclui MAX6675
- int thermoDO = 11;
- int thermoCS = 12;
- int thermoCLK = 6;
- #define rele 13
- MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO); //Cria objeto para termopar e MAX6675
- // --- Hardware do LCD ---
- LiquidCrystal lcd (8, //RS no digital 8
- 7, //EN no digital 7
- 5, //D4 no digital 5
- 4, //D5 no digital 4
- 3, //D6 no digital 3
- 2); //D7 no digital 2
- int minhaTemp = 0;
- //-------------------------------------------------------------------------
- void setup() {
- lcd.begin(16, 2); //inicializa LCD 16x2
- Serial.begin(9600);
- pinMode(rele, OUTPUT);
- Serial.println("MAX6675");
- delay(500);
- }
- //-------------------------------------------------------------------------
- void loop() {
- //Limpa a tela
- lcd.clear(); //Limpa o LCD
- lcd.setCursor(3, 0); //Posiciona o cursor na coluna 3, linha 0;
- lcd.print("Temperatura"); //Envia o texto entre aspas para o LCD
- lcd.setCursor(4,2);
- lcd.print("C = ");
- lcd.setCursor(9,2);
- lcd.print(thermocouple.readCelsius()); //Imprime temperatura em graus Celsius no LCD
- delay(5000);
- Serial.print("C = "); //Imprime temperatura em graus Celsius no Terminal
- minhaTemp = thermocouple.readCelsius();
- Serial.println(minhaTemp);
- if (minhaTemp < 133)
- digitalWrite(rele, HIGH);
- if (minhaTemp > 135)
- digitalWrite(rele, LOW);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement