Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <MAX6675_Thermocouple.h>
- #define SCK_PIN 3
- #define CS_PIN 4
- #define SO_PIN 5
- #define READINGS_NUMBER 10
- #define DELAY_TIME 20
- double desiredTempC = 250; // which temperature to maintain
- MAX6675_Thermocouple* thermocouple = NULL;
- int relayPin = 8;// set pin 8 for relay output
- void setup() {
- Serial.begin(9600);
- thermocouple = new MAX6675_Thermocouple(
- SCK_PIN, CS_PIN, SO_PIN,
- READINGS_NUMBER, DELAY_TIME
- );
- Serial.println("Recycling Of Waste Plastics Using Injection Moulding Machine");
- Serial.println("Relay ON, Band Heaters On ");
- Serial.println("Temperature to Achieve")+ Serial.println(desiredTempC)+ Serial.println(" degrees C");
- pinMode(relayPin, OUTPUT);
- }
- void loop() {
- double readingTempC = thermocouple->readCelsius();
- Serial.print(readingTempC); Serial.println(" degrees C");
- if(readingTempC < desiredTempC-2){
- digitalWrite(relayPin, HIGH);// set relay pin to LOW
- Serial.println("Relay ON ");
- delay(2000);
- }
- else if(readingTempC > desiredTempC+2){
- digitalWrite(relayPin, LOW);// set relay pin to LOW
- Serial.println("Relay OFF ");
- delay(2000);
- }
- }
Add Comment
Please, Sign In to add comment