diff --git a/Kiln_Controller.ino b/Kiln_Controller.ino index a07806a..c003237 100644 --- a/Kiln_Controller.ino +++ b/Kiln_Controller.ino @@ -3,17 +3,66 @@ #include #include "Adafruit_MCP23017.h" -int MISO0 = 12; -int CLK0 = 13; -int CS0 = 16; +#include +#include +#include +///// USER SETTINGS ///// + +// WiFi Settings +const char *ssid = "ESPap"; +const char *password = "thereisnospoon"; + +// Temperature Offsets +int t1off = 0; +int t2off = 0; +int t3off = 0; + +// Pinout +int CLK0 = 13; +int MISO0 = 12; +int CS1 = 16; +int CS2 = 14; +int CS3 = 15; + +///// END USER SETTINGS ///// + +// Thermocouple stuff +MAX6675 t1(CLK0, CS1, MISO0); +MAX6675 t2(CLK0, CS2, MISO0); +MAX6675 t3(CLK0, CS3, MISO0); +int temp1, temp2, temp3; + +// Output Stuff LiquidCrystal_I2C lcd(0x3f, 20, 4); -MAX6675 t0(CLK0, CS0, MISO0); Adafruit_MCP23017 mcp; +// WiFi Stuff +ESP8266WebServer server(80); + +// Control Stuff +int onTemp = 70; +int offTemp = 80; + +///// WEB SERVER ///// +void handleRoot() { + server.send(200, "text/html", "" + "

Kiln Controller V1

" + "Page 2" + ""); +} + +void handlePage2() { + server.send(200, "text/html", "" + "

Page 2

" + "Home" + ""); +} + +///// SETUP ///// void setup() { // Onboard LED - pinMode(2,OUTPUT); + pinMode(2, OUTPUT); // I2C Wire.pins(4, 5); @@ -42,21 +91,55 @@ void setup() { mcp.digitalWrite(2, LOW); mcp.digitalWrite(3, LOW); + // Temperature Inital Values + temp1 = t1.readFahrenheit(); + temp2 = t2.readFahrenheit(); + temp3 = t3.readFahrenheit(); + + // Access Point Setup + WiFi.softAP(ssid, password); + IPAddress myIP = WiFi.softAPIP(); + server.on("/", handleRoot); + server.on("/page2", handlePage2); + server.begin(); + lcd.clear(); + lcd.setCursor(0, 0); lcd.print("SSID: "); lcd.print(ssid); + lcd.setCursor(0, 1); lcd.print("PSWD: "); lcd.print(password); + lcd.setCursor(0, 2); lcd.print("IP : "); lcd.print(myIP); + + delay(1000); + // Clear LCD lcd.setCursor(0, 0); lcd.clear(); } void loop() { - // Get value - lcd.setCursor(0, 0); - lcd.print(t0.readFahrenheit()); - lcd.print("F "); - lcd.print(t0.readCelsius()); - lcd.print("C"); + server.handleClient(); + // Get values + temp1 = t1.readFahrenheit() + t1off; + temp2 = t2.readFahrenheit() + t2off; + temp3 = t3.readFahrenheit() + t3off; + + // Write to LCD + lcd.clear(); + lcd.setCursor(0, 0); + lcd.print("1: "); + lcd.print(temp1); + lcd.print(" F"); + lcd.setCursor(0, 1); + lcd.print("2: "); + lcd.print(temp2); + lcd.print(" F"); + lcd.setCursor(0, 2); + lcd.print("3: "); + lcd.print(temp3); + lcd.print(" F"); + + // Heartbeat LED digitalWrite(2, LOW); delay(100); digitalWrite(2, HIGH); - delay(1000); + delay(900); }