Guest User

Untitled

a guest
Apr 11th, 2019
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #include <MAX6675_Thermocouple.h>
  2.  
  3. #define SCK_PIN 3
  4. #define CS_PIN 4
  5. #define SO_PIN 5
  6.  
  7. #define READINGS_NUMBER 10
  8. #define DELAY_TIME 20
  9. double desiredTempC = 250; // which temperature to maintain
  10. MAX6675_Thermocouple* thermocouple = NULL;
  11. int relayPin = 8;// set pin 8 for relay output
  12.  
  13.  
  14. void setup() {
  15. Serial.begin(9600);
  16. thermocouple = new MAX6675_Thermocouple(
  17. SCK_PIN, CS_PIN, SO_PIN,
  18. READINGS_NUMBER, DELAY_TIME
  19. );
  20. Serial.println("Recycling Of Waste Plastics Using Injection Moulding Machine");
  21. Serial.println("Relay ON, Band Heaters On ");
  22. Serial.println("Temperature to Achieve")+ Serial.println(desiredTempC)+ Serial.println(" degrees C");
  23. pinMode(relayPin, OUTPUT);
  24.  
  25. }
  26. void loop() {
  27. double readingTempC = thermocouple->readCelsius();
  28. Serial.print(readingTempC); Serial.println(" degrees C");
  29.  
  30.  
  31. if(readingTempC < desiredTempC-2){
  32. digitalWrite(relayPin, HIGH);// set relay pin to LOW
  33. Serial.println("Relay ON ");
  34. delay(2000);
  35. }
  36. else if(readingTempC > desiredTempC+2){
  37. digitalWrite(relayPin, LOW);// set relay pin to LOW
  38. Serial.println("Relay OFF ");
  39. delay(2000);
  40.  
  41. }
  42.  
  43.  
  44.  
  45. }
Add Comment
Please, Sign In to add comment