Skip to content

Commit

Permalink
Add RELAY_ON /RELAY_OFF per br3ttb#136
Browse files Browse the repository at this point in the history
  • Loading branch information
David R Forrest committed May 1, 2023
1 parent c5d1d17 commit 1eeac79
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/PID_RelayOutput/PID_RelayOutput.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#define PIN_INPUT 0
#define RELAY_PIN 6
#define RELAY_ON LOW
#define RELAY_OFF HIGH

//Define Variables we'll be connecting to
double Setpoint, Input, Output;
Expand Down Expand Up @@ -55,8 +57,14 @@ void loop()
{ //time to shift the Relay Window
windowStartTime += WindowSize;
}
if (Output < millis() - windowStartTime) digitalWrite(RELAY_PIN, HIGH);
else digitalWrite(RELAY_PIN, LOW);
if (Output > millis() - windowStartTime)
{
digitalWrite(RELAY_PIN, RELAY_ON);
}
else
{
digitalWrite(RELAY_PIN, RELAY_OFF);
}

}

Expand Down

0 comments on commit 1eeac79

Please sign in to comment.