Skip to content

Commit

Permalink
Change comment. Rename variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelgran committed Oct 14, 2019
1 parent c7d862e commit 53b2224
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
27 changes: 14 additions & 13 deletions crepemaker.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// The user.h file contains user-definable compiler options
// It must be located in the same folder as this file
#include "user.h"
Expand All @@ -6,7 +7,7 @@
#include "max6675.h"

// other compile directives
#define LOOPTIME 1000 // cycle time, in ms
#define LOOPTIME 500 // cycle time, in ms

// global variables and objects
MAX6675 thermocouple1(CLKPIN, CS1PIN, DOPIN);
Expand All @@ -17,7 +18,7 @@ float previoustemp2 = 0;
unsigned long timestamp = 0;
int counter = 0;

void seriallogger(float temp1, float temp2, float ror1, float ror2, float correctedtemp1, float correctedtemp2) {
void seriallogger(float temp1, float temp2, float ror1, float ror2, float projectedtemp1, float projectedtemp2) {
Serial.print(temp1);
Serial.print(",");
Serial.print(temp2);
Expand All @@ -26,9 +27,9 @@ void seriallogger(float temp1, float temp2, float ror1, float ror2, float correc
Serial.print(",");
Serial.print(ror2);
Serial.print(",");
Serial.print(correctedtemp1);
Serial.print(projectedtemp1);
Serial.print(",");
Serial.println(correctedtemp2);
Serial.println(projectedtemp2);
}

void setup() {
Expand All @@ -47,8 +48,8 @@ void loop() {
float temp2;
float ror1;
float ror2;
float correctedtemp1;
float correctedtemp2;
float projectedtemp1;
float projectedtemp2;

temp1 = thermocouple1.readCelsius();
temp2 = thermocouple2.readCelsius();
Expand All @@ -66,29 +67,29 @@ void loop() {
counter++;

if (ror1 >= 0) {
correctedtemp1 = (temp1 + (ror1 * RISEINERTIA));
projectedtemp1 = (temp1 + (ror1 * RISEINERTIA));
}
else {
correctedtemp1 = (temp1 + (ror1 * FALLINERTIA));
projectedtemp1 = (temp1 + (ror1 * FALLINERTIA));
}

if (ror2 >= 0) {
correctedtemp2 = (temp2 + (ror2 * RISEINERTIA));
projectedtemp2 = (temp2 + (ror2 * RISEINERTIA));
}
else {
correctedtemp2 = (temp2 + (ror2 * FALLINERTIA));
projectedtemp2 = (temp2 + (ror2 * FALLINERTIA));
}

seriallogger(temp1,temp2,ror1,ror2,correctedtemp1,correctedtemp2);
seriallogger(temp1,temp2,ror1,ror2,projectedtemp1,projectedtemp2);

if (correctedtemp1 <= SV1) {
if (projectedtemp1 <= SV1) {
digitalWrite(SSR2PIN, LOW);
digitalWrite(SSR1PIN, HIGH);
}
else {
digitalWrite(SSR1PIN, LOW);

if (correctedtemp2 <= SV2) {
if (projectedtemp2 <= SV2) {
digitalWrite(SSR2PIN, HIGH);
}
else {
Expand Down
14 changes: 10 additions & 4 deletions user.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@
// Next compile the sketch and upload it to the Arduino.

// Set values
#define SV1 190 //Set temperature for plate 1 (in Celsius)
#define SV2 190 //Set temperature for plate 2 (in Celsius)
#define SV1 200 //Set temperature for plate 1 (in Celsius)
#define SV2 200 //Set temperature for plate 2 (in Celsius)

#define RISEINERTIA 3 //how long it takes the system to stop rising (in min)
#define FALLINERTIA 1 //how long it takes the system to stop rising (in min)
#define FALLINERTIA 1 //how long it takes the system to stop falling (in min)

#define SAMPLING 5 //loops to calculate ror

// Delay time between temperature readings
// from the temperature sensor (ms).
#define DELAY_TIME 20

// How many readings are taken to determine a mean temperature.
#define READINGS 10

// Pin mapping
// Common SPI pins
#define DOPIN 12
Expand All @@ -24,7 +31,6 @@
// SPI Chip Select for each MAX6675 chip
#define CS1PIN 11
#define CS2PIN 10

// SSR control
#define SSR1PIN 8
#define SSR2PIN 9
Expand Down

0 comments on commit 53b2224

Please sign in to comment.