First blink the LED at a given temp (which works fine)
Then at a second temperature I wanted to very quickly toggle a conventional coil relay(the one in the starter kit)
The LED works but the delay function led me to "Timer" I did my best to get this on my own but all I can do is get the relay to tick away. Nothing I seem to do changes the rate of tick.
I stopped short of trying to get it to activate at a given temp because I wasnt able to get the relay to work as I wanted to
Code: Select all
****************************************************/
#include "Adafruit_MAX31855.h"
#include <LiquidCrystal.h>
#include "Timer.h"
Timer t;
int thermoCLK = 2;
int thermoCS = 4;
int thermoDO = 5;
int ET;
int led = 13;
int pin = 6;
// Initialize the Thermocouple
Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() {
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.print("Engine Saver");
// wait for MAX chip to stabilize
delay(500);
pinMode(led, OUTPUT);
pinMode(6, OUTPUT);
}
void loop() {
// basic readout test, just print the current temp
lcd.setCursor(0, 0);
//lcd.print("Int. Temp = ");
//lcd.println(thermocouple.readInternal());
//lcd.print(" ");
//t.update();
double c = thermocouple.readCelsius();
lcd.setCursor(0, 1);
if (isnan(c))
{
lcd.print("T/C Problem");
}
else
{
lcd.print("EGT = ");
lcd.print(c * 1.8 + 32);
lcd.print(" ");
ET = (c * 1.8 + 32);
if (ET > 75) digitalWrite(led,HIGH); delay(500); digitalWrite(led,LOW); delay(50);
if (ET < 75) digitalWrite(led,LOW);
//if (ET > 81) digitalWrite(RLY, HIGH); delay(50); digitalWrite(RLY, LOW); delay(50);
//if (ET > 81) r.oscillate(6, 50, HIGH,5); // the 5 is how many times it blinks
//if (ET > 81) r.oscillate(6, 10, HIGH);
t.oscillate(6,5,HIGH);
t.update();
Serial.println(ET);
}
//delay(1000);
}[code]
****************************************************/