Skip to content

Commit

Permalink
Add seriallogger sub
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelgran committed Dec 20, 2018
1 parent 9963f42 commit c7d862e
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions crepemaker.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,31 @@
// global variables and objects
MAX6675 thermocouple1(CLKPIN, CS1PIN, DOPIN);
MAX6675 thermocouple2(CLKPIN, CS2PIN, DOPIN);

float previoustemp1 = 0;
float previoustemp2 = 0;
unsigned long timestamp = 0;
int counter = 0;

void seriallogger(float temp1, float temp2, float ror1, float ror2, float correctedtemp1, float correctedtemp2) {
Serial.print(temp1);
Serial.print(",");
Serial.print(temp2);
Serial.print(",");
Serial.print(ror1);
Serial.print(",");
Serial.print(ror2);
Serial.print(",");
Serial.print(correctedtemp1);
Serial.print(",");
Serial.println(correctedtemp2);
}

void setup() {
pinMode(SSR1PIN, OUTPUT);
pinMode(SSR2PIN, OUTPUT);

Serial.begin(BAUD);
Serial.println("temp1,temp2,ror1,ror2,correctedtemp1,corectedtemp2");

// wait for MAX chips to stabilize
delay(500);
Expand All @@ -37,7 +51,7 @@ void loop() {
float correctedtemp2;

temp1 = thermocouple1.readCelsius();
temp2 = 0; //thermocouple2.readCelsius(); -- disabled --
temp2 = thermocouple2.readCelsius();

if (counter >= SAMPLING) {
timeelapsed = (millis() - timestamp);
Expand Down Expand Up @@ -65,17 +79,7 @@ void loop() {
correctedtemp2 = (temp2 + (ror2 * FALLINERTIA));
}

Serial.print(temp1);
Serial.print(",");
Serial.print(temp2);
Serial.print(",");
Serial.print(ror1);
Serial.print(",");
Serial.print(ror2);
Serial.print(",");
Serial.print(correctedtemp1);
Serial.print(",");
Serial.println(correctedtemp2);
seriallogger(temp1,temp2,ror1,ror2,correctedtemp1,correctedtemp2);

if (correctedtemp1 <= SV1) {
digitalWrite(SSR2PIN, LOW);
Expand Down

0 comments on commit c7d862e

Please sign in to comment.