// setting up all my constants / variables. Naming, Pin assignment, etc.
int s1Status = LOW;
const int s1statusPin = 9;
const int coolantButtonPin = 7;
const int coolantLedPin = 13;
int coolantButtonState = 0;
int powerButtonState = 0;
int coolantVal = 0;
int coolantPin = A5;
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h> // Library for LCD
LiquidCrystal_I2C lcd2(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
//servo stuff
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
lcd2.init(); //initialize the lcd
myservo.attach(14); // attaches the servo on pin 9 to the servo object
//recognizing the pins as either outputs / inputs
pinMode(coolantLedPin, OUTPUT);
pinMode(coolantButtonPin, INPUT);
pinMode(s1statusPin, INPUT);
Serial.begin(9600);
Serial.println("hello");
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
// nice Greeting For the User
lcd.begin(16, 2);
lcd.print("Hello!");
delay(1000);
lcd.clear();
lcd.print("Please fill");
lcd.setCursor(0, 1);
lcd.print("Coolant Before");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Turning on");
lcd.setCursor(0,1);
lcd.print("Sensor.");
delay(1000);
lcd.clear();
}
void loop() {
Serial.print(s1Status);
Serial.println(digitalRead(s1statusPin));
delay(100);
// reads the state of each button:
s1Status = digitalRead(s1statusPin);
coolantButtonState = digitalRead(coolantButtonPin);
// checks if the coolant button is pressed. If it is, the buttonState is HIGH (which means on):
if (coolantButtonState == HIGH) { //this setup allows the user to simulate with or without a cup of water next to them lol.
lcd.setCursor(0, 1);
lcd.print("Coolant Cycling.");
lcd2.setCursor(0,0);
lcd2.print("Chiller On");
} else {
// turn LED off:
lcd.setCursor(0, 1);
lcd.print("No Coolant Flow.");
lcd2.clear();
delay(100);
}
if (s1Status == HIGH and coolantButtonState == HIGH) {
pos = random(0,179);
myservo.write(pos);
delay(1000);
}
}
24V Chiller PSU
24V Chiller Unit
270V Sensor PSU
Sensors