RuiViana

Termo.ino

Aug 5th, 2020 (edited)
1,174
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "max6675.h"
  2.  
  3. int thermoDO = 11;
  4. int thermoCS = 12;
  5. int thermoCLK = 6;
  6.  
  7. MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
  8. #define rele  13
  9. int minhaTemp = 0;
  10. //-------------------------------------------------------------------------
  11. void setup() {
  12.   Serial.begin(9600);
  13.   pinMode(rele, OUTPUT);
  14.   Serial.println("MAX6675 test");
  15.   // wait for MAX chip to stabilize
  16.   delay(500);
  17. }
  18. //-------------------------------------------------------------------------
  19. void loop() {
  20.   Serial.print("C = ");
  21.   minhaTemp = thermocouple.readCelsius();
  22.   Serial.println(minhaTemp);
  23.   if (minhaTemp < 133)
  24.     digitalWrite(rele, LOW);
  25.   if (minhaTemp > 135)
  26.     digitalWrite(rele, HIGH);
  27.   delay(1000);
  28. }
RAW Paste Data