Browse Source

first release + documentation

master
studentidisinistra 2 years ago
parent
commit
c6973c698f
19 changed files with 347 additions and 41 deletions
  1. BIN
      Documentation and Pictures/Press Wheel micro-switch positioning.jpg
  2. BIN
      Documentation and Pictures/Thermal protection Switches.jpg
  3. BIN
      Documentation and Pictures/press wheel repair 1.jpg
  4. BIN
      Documentation and Pictures/press wheel repair 2.jpg
  5. BIN
      Documentation and Pictures/press wheel repair 3 (wheel coupling cut).jpg
  6. BIN
      Documentation and Pictures/release press for regular maintenance.jpg
  7. BIN
      Documentation and Pictures/top view.pdf
  8. BIN
      Documentation and Pictures/unlock coffee nozzle (pull down after removing screw).jpg
  9. BIN
      Documentation and Pictures/unlock coffee nozzle.jpg
  10. +0
    -0
      Pinouts/(old)config.coffee
  11. BIN
      Pinouts/Boiler thermocouple.jpg
  12. BIN
      Pinouts/LCD connection.pdf
  13. BIN
      Pinouts/board pinout.pdf
  14. +0
    -0
      Pinouts/old PyCoffee Machine Pinout (arduino pins still valid).jpg
  15. BIN
      Pinouts/pinoutLCD.png
  16. +1
    -0
      Pushing to GITEA
  17. +262
    -20
      PyCoffeeESP8266/PyCoffeeESP8266.ino
  18. BIN
      PyCoffeeESP8266/Release 1 for ESP compiled.bin
  19. +84
    -21
      PyCoffeeNano/PyCoffeeNano.ino

BIN
Documentation and Pictures/Press Wheel micro-switch positioning.jpg View File

Before After
Width: 949  |  Height: 604  |  Size: 63 KiB

BIN
Documentation and Pictures/Thermal protection Switches.jpg View File

Before After
Width: 1547  |  Height: 1547  |  Size: 266 KiB

BIN
Documentation and Pictures/press wheel repair 1.jpg View File

Before After
Width: 790  |  Height: 674  |  Size: 42 KiB

BIN
Documentation and Pictures/press wheel repair 2.jpg View File

Before After
Width: 822  |  Height: 675  |  Size: 62 KiB

BIN
Documentation and Pictures/press wheel repair 3 (wheel coupling cut).jpg View File

Before After
Width: 905  |  Height: 696  |  Size: 101 KiB

BIN
Documentation and Pictures/release press for regular maintenance.jpg View File

Before After
Width: 897  |  Height: 761  |  Size: 57 KiB

BIN
Documentation and Pictures/top view.pdf View File


BIN
Documentation and Pictures/unlock coffee nozzle (pull down after removing screw).jpg View File

Before After
Width: 902  |  Height: 804  |  Size: 44 KiB

BIN
Documentation and Pictures/unlock coffee nozzle.jpg View File

Before After
Width: 837  |  Height: 792  |  Size: 45 KiB

Pinouts/config.coffee → Pinouts/(old)config.coffee View File


BIN
Pinouts/Boiler thermocouple.jpg View File

Before After
Width: 1547  |  Height: 1547  |  Size: 244 KiB

BIN
Pinouts/LCD connection.pdf View File


BIN
Pinouts/board pinout.pdf View File


Pinouts/Machine Pinout.jpg → Pinouts/old PyCoffee Machine Pinout (arduino pins still valid).jpg View File


BIN
Pinouts/pinoutLCD.png View File

Before After
Width: 1587  |  Height: 1032  |  Size: 98 KiB

+ 1
- 0
Pushing to GITEA View File

@ -7,4 +7,5 @@ git push -u origin master
later:
git add .
git commit -m "your commit comment here"
git push -u origin master

+ 262
- 20
PyCoffeeESP8266/PyCoffeeESP8266.ino View File

@ -5,6 +5,7 @@
#include <AsyncElegantOTA.h>
#include <Wire.h>
#include <LiquidCrystal.h>
#include <EEPROM.h> // to store number of coffees made and pumped water
AsyncWebServer server(80);
@ -14,13 +15,12 @@ unsigned long startTime;
// WiFi settings
const char* ssid = "LILiK_WiFi"; //replace with your SSID
const char* password = "pippopippo"; //password
//const char* ssid = "AulaStud"; //replace with your SSID
//const char* password = "cinimerda"; //password
String hostname = "PyCoffee";
int wifiStatus = 0; // variable to store status (connected/disconnected, used by LCDprint)
// string to store coffee style from HTML
String input_field = "espr";
String input_field = ""; // string for coffee type
String input_field2 = ""; // string for serial commands
// HTML WEB interface
const char index_html[] PROGMEM = R"rawliteral(
@ -46,7 +46,33 @@ const char index_html[] PROGMEM = R"rawliteral(
</form>
<br><br>
<a>Clicca qui sotto per aggiornare il firmware:</a> <br>
<a>Puoi mandare comandi a Arduino via seriale</a><br>
<a>usa 'exit' per uscire dall'ultimo comando seriale</a><br><br>
<form action="/serial">
<select name="serial_input">
<option value="exit">Exit Command</option>
<option value="dryr">PerformDryRun</option>
<option value="noco">NoCoffeeRun</option>
<option value="clea">Self-Clean</option>
<option value="make">Make Coffee</option>
<option value="pump">pumpWater</option>
<option value="pres">Press</option>
<option value="unpr">un-Press</option>
<option value="heat">Heat Boiler</option>
<option value="grin">GrindPowder</option>
<option value="drop">Drop Powder</option>
<option value="rist">setRistretto</option>
<option value="espr">setEspresso</option>
<option value="long">setLungo</option>
</select><br><br>
<input type="submit" value="Invia Comando">
</form>
<br><br>
<a>Consulta la pagina Gitea per maggiori informazioni</a><br><br>
<a>Aggiornamento firmware:</a> <br>
<a href='/update'>&#11014;&#65039; OTA Firmware_Update &#11014;&#65039;</a><br><br>
<a>Codice sorgente (su LILiK projects):</a> <br>
<a href='https://projects.lilik.it/LILiK/PyCoffee_ESP8266'>&#9749;Gitea&#9749;</a><br><br>
@ -55,25 +81,36 @@ const char index_html[] PROGMEM = R"rawliteral(
// input parameter for html server
const char* input_paramter1 = "coffee_input";
const char* input_paramter2 = "serial_input";
// enable http coffee making on server request
int httpCoffee = 0;
int serialCommand = 0;
// button pins
const int sel = 0, enter = 2;
// Global string
// Global string, allows serial in
String readString;
// coffee type variable
String type = "Espresso";
// number of coffees made and seconds of pumped water since last tray empty/water refill
// used by checkTrayWater() function
int coffeesDone = 0;
int pumpedS = 0;
const int MaxCoffees = 10;
const int MaxPumped = 205;
// Support string to store stuff to be sent over serial
String serialOUTbuffer = "none";
// Variables to store lines to be printed on LCD:
String line1 = "";
String line2 = "";
// only refresh LCD when needed
int printed = 0;
// LCD pins <--> ESP8266 LOLIN D1 pins
const int e_RS = 4, e_EN = 5, e_D6 = 12, e_D7 = 13, e_D5 = 14, e_D8 = 15;
@ -91,6 +128,9 @@ byte cupL1[8] = {0b00100,0b00100,0b00100,0b00010,0b01111,0b01000,0b00111,0b00000
byte cupC1[8] = {0b00000,0b00000,0b00000,0b00000,0b11111,0b00000,0b11111,0b00000};
// Custom character matrix (coffee cup right side line 2)
byte cupR1[8] = {0b01010,0b01010,0b01110,0b10000,0b11100,0b00100,0b11000,0b00000};
// Custom character matrix (WiFi connected/disconnected)
byte wifiok[8] = {0b00000,0b01110,0b10001,0b00100,0b01010,0b00000,0b00000,0b00100};
byte wifino[8] = {0b00000,0b10001,0b01010,0b00100,0b01010,0b10001,0b00000,0b00100};
void notFound(AsyncWebServerRequest *request) {
request->send(404, "text/plain", "Not found");
@ -101,6 +141,10 @@ void notFound(AsyncWebServerRequest *request) {
// the setup function runs once when you press reset or power the board
void setup(void) {
// check how many coffees were done and seconds of pumped water from EEPROM
coffeesDone = (EEPROM.read(0));
pumpedS = (EEPROM.read(1));
// Set buttons as inputs with internal pull-ups
pinMode(enter, INPUT_PULLUP);
pinMode(sel, INPUT_PULLUP);
@ -115,6 +159,8 @@ void setup(void) {
lcd.createChar(3, cupL1);
lcd.createChar(4, cupC1);
lcd.createChar(5, cupR1);
lcd.createChar(6, wifiok);
lcd.createChar(7, wifino);
lcd.begin(16, 2); // set up number of columns and rows
lcd.clear(); // Clear LCD
@ -134,6 +180,7 @@ void setup(void) {
});
// Get data from menu
// coffee
server.on("/get", HTTP_GET, [] (AsyncWebServerRequest *request) {
if (request->hasParam(input_paramter1)) {
type = request->getParam(input_paramter1)->value();
@ -141,6 +188,17 @@ void setup(void) {
}
request->send_P(200, "text/html", index_html); // Re-send main page, with data!
});
// serial commands
server.on("/serial", HTTP_GET, [] (AsyncWebServerRequest *request) {
if (request->hasParam(input_paramter2)) {
if (serialOUTbuffer != "") {
serialOUTbuffer = request->getParam(input_paramter2)->value();
serialCommand = 1;
httpCoffee = 0;
}
}
request->send_P(200, "text/html", index_html); // Re-send main page, with data!
});
// in case of error:
server.onNotFound(notFound);
@ -149,9 +207,8 @@ void setup(void) {
Serial.println("HTTP server started");
// Print selection screen
line1 = "Selection";
line2 = type;
LCDprint();
printed = 1;
// tell the Arduino we're ready
serialOUTbuffer = "read";
delay(100);
@ -162,7 +219,9 @@ void setup(void) {
void loop() {
// the loop function runs over and over again forever
delay(10);
checkTrayWater();
delay(10);
serialFromHTTP();
// select type of brew by pressing the sel button
if (digitalRead(sel) == LOW && type == "Espresso") {
@ -186,6 +245,32 @@ void loop() {
LCDprint();
delay(500);
}
else if (Serial.available() > 0) {
// read the incoming data: (we only care about the first few characters, I've chosen 4)
readString = "";
serialRead();
String incomingData = readString.substring(0,4);
// are we heating the boiler to vapor temperature?
if (incomingData == "Vapo") {
line1 = "Heating";
line2 = "Vapor";
LCDprint();
delay(1000);
}
if (incomingData == "reac") {
line1 = "Vapor";
line2 = "ok";
LCDprint();
delay(1000);
printed = 1;
delay(10000);
serialOUTbuffer = "unpr";
writeSerial();
delay(100);
}
}
refreshMenu();
delay(100);
// check if data has been sent on serial from Arduino,
// send commands to arduino and display corresponding messages on LCD
@ -212,16 +297,21 @@ void bootAnimation() {
delay(1000);
line1 = "ESP_Coffee";
line2 = "Beta 1";
line2 = "Release 1";
LCDprint();
delay(1000);
lcd.setCursor(12,0); //print coffee cup top using uint8 method
lcd.setCursor(11,0); //print coffee cup top using uint8 method
lcd.write((uint8_t)0);
delay(10);
lcd.write((uint8_t)1);
delay(10);
lcd.write((uint8_t)2);
lcd.setCursor(12,1); //print coffee cup bottom using uint8 method
delay(10);
lcd.setCursor(11,1); //print coffee cup bottom using uint8 method
lcd.write((uint8_t)3);
delay(10);
lcd.write((uint8_t)4);
delay(10);
lcd.write((uint8_t)5);
delay(2000);
}
@ -239,9 +329,12 @@ void connectedTo() {
line1 = "Timeout at SSID";
line2 = ssid;
LCDprint();
delay(10000);
break;
}
delay(10000);
else {
wifiStatus = 1;
}
}
Serial.println("");
@ -257,19 +350,59 @@ void connectedTo() {
line1 = "Connected to IP:";
line2 = "";
LCDprint();
lcd.setCursor(0, 1); // move cursor to (0, 0)
delay(10);
lcd.setCursor(0, 1); // move cursor to (0, 1)
lcd.print(WiFi.localIP()); // re-print line2 or IP won't print
delay(2000);
}
//_____________________________________________________________________________
void refreshMenu() {
if (line1 == "Selection" && printed == 1) {
lcd.clear();
lcd.setCursor(0, 0); // move cursor to (0, 0)
lcd.print(line1); // print line1
delay(10);
lcd.setCursor(15, 0); // move cursor to (14, 0)
// print wifi logo depending on connection starus
if (wifiStatus == 1) {
lcd.write((uint8_t)6);
delay(10);
}
else if (wifiStatus == 0) {
lcd.write((uint8_t)7);
delay(10);
}
lcd.setCursor(0, 1); // move cursor to (0, 1)
lcd.print(line2); // print line2
delay(10);
printed = 0;
}
}
//_____________________________________________________________________________
void LCDprint() {
lcd.clear();
lcd.setCursor(0, 0); // move cursor to (0, 0)
lcd.print(line1); // print line1
lcd.setCursor(0, 1); // move cursor to (0, 0)
delay(10);
lcd.setCursor(15, 0); // move cursor to (14, 0)
// print wifi logo depending on connection starus
if (wifiStatus == 1) {
lcd.write((uint8_t)6);
delay(10);
}
else if (wifiStatus == 0) {
lcd.write((uint8_t)7);
delay(10);
}
lcd.setCursor(0, 1); // move cursor to (0, 1)
lcd.print(line2); // print line2
delay(10);
}
//_____________________________________________________________________________
@ -280,17 +413,119 @@ void writeSerial() {
//_____________________________________________________________________________
void serialFromHTTP() {
if (serialCommand == 1){
serialCommand = 0;
line1 = "serialCom";
line2 = serialOUTbuffer;
LCDprint();
delay(1000);
writeSerial();
while (serialOUTbuffer != "exit" && digitalRead(sel) == HIGH ) {
if (Serial.available() > 0) {
// read the incoming data: (we only care about the first few characters, I've chosen 4)
readString = "";
serialRead();
String incomingData = readString.substring(0,16);
Serial.print("serial put from Arduino:\n");
Serial.print(incomingData);
Serial.print("\n");
if (serialOUTbuffer != "none") {
line1 = serialOUTbuffer;
}
line2 = incomingData;
LCDprint();
delay(100);
serialOUTbuffer = "none";
writeSerial();
}
}
line1 = "Selection";
line2 = type;
LCDprint();
delay(500);
}
}
//_____________________________________________________________________________
void checkTrayWater() {
// section dedicated to empty tray and refill water messages
if ((EEPROM.read(0)) < 0 or (EEPROM.read(0)) > MaxCoffees + 1) {
EEPROM.write(0, 0);
EEPROM.commit();
}
else if ((EEPROM.read(0)) < coffeesDone) {
EEPROM.write(0, coffeesDone);
EEPROM.commit();
}
if ((EEPROM.read(1)) < 0 or (EEPROM.read(1)) > MaxPumped + 1) {
EEPROM.write(1, 0);
EEPROM.commit();
}
else if ((EEPROM.read(1)) < pumpedS) {
EEPROM.write(1, pumpedS);
EEPROM.commit();
}
if (coffeesDone > (MaxCoffees - 1)) {
lcd.clear();
while (digitalRead(enter) == HIGH) {
lcd.setCursor(0, 0); // move cursor to (0, 0)
lcd.print("Empty Tray"); // print line1
delay(10);
lcd.setCursor(0, 1); // move cursor to (0, 1)
lcd.print("Then hold Make"); // print line2
delay(10);
}
coffeesDone = 0;
EEPROM.write(0, coffeesDone);
EEPROM.commit();
delay(500);
LCDprint();
delay(500);
printed = 1;
}
if (pumpedS > (MaxPumped + 1)) {
lcd.clear();
while (digitalRead(enter) == HIGH) {
lcd.setCursor(0, 0); // move cursor to (0, 0)
lcd.print("Refill Water"); // print line1
delay(10);
lcd.setCursor(0, 1); // move cursor to (0, 1)
lcd.print("Then hold Make"); // print line2
delay(10);
}
pumpedS = 0;
EEPROM.write(1, pumpedS);
EEPROM.commit();
delay(500);
LCDprint();
delay(500);
printed = 1;
}
line1 = "Selection";
line2 = type;
}
//_____________________________________________________________________________
void serialCoffeeCommandLCDInterface() {
if (digitalRead(enter) == LOW or httpCoffee == 1) {
httpCoffee = 0;
if (type == "Espresso") {
serialOUTbuffer = "espr";
pumpedS = pumpedS + 15;
}
else if (type == "Lungo") {
serialOUTbuffer = "long";
pumpedS = pumpedS + 18;
}
else if (type == "Ristretto") {
serialOUTbuffer = "rist";
pumpedS = pumpedS + 12;
}
writeSerial();
delay(500);
@ -310,15 +545,23 @@ void serialCoffeeCommandLCDInterface() {
line1 = "Making";
line2 = type;
LCDprint();
delay(10);
lcd.setCursor(12,0); //print coffee cup top using uint8 method
lcd.setCursor(11,0); //print coffee cup top using uint8 method
lcd.write((uint8_t)0);
delay(10);
lcd.write((uint8_t)1);
delay(10);
lcd.write((uint8_t)2);
lcd.setCursor(12,1); //print coffee cup bottom using uint8 method
delay(10);
lcd.setCursor(11,1); //print coffee cup bottom using uint8 method
lcd.write((uint8_t)3);
delay(10);
lcd.write((uint8_t)4);
delay(10);
lcd.write((uint8_t)5);
delay(10);
}
@ -406,14 +649,13 @@ void serialCoffeeCommandLCDInterface() {
}
}
if (incomingData == "Comp") {
coffeesDone++;
Serial.print("Made coffee\n");
line1 = "Coffee Done :)";
line2 = "Enjoy!";
LCDprint();
delay(5000);
line1 = "Selection";
line2 = type;
LCDprint();
delay(500);
}
}


BIN
PyCoffeeESP8266/PyCoffeeESP8266.ino.d1_mini.bin → PyCoffeeESP8266/Release 1 for ESP compiled.bin View File


+ 84
- 21
PyCoffeeNano/PyCoffeeNano.ino View File

@ -10,7 +10,7 @@ String readString;
int Vo;
float R1 = 10000; // <-- change this value to the resistance of the fixed resistor (so don't change PLS!)
float logR2, R2, T, Tc, Told;
float c1 = 7.9e-04, c2 = 1.85e-04, c3 = 2e-07; // Here's where you can perform actual calibration
float c1 = 8.5e-04, c2 = 1.85e-04, c3 = 2e-07; // Here's where you can perform actual calibration
// Variable to store desired Max boiler Temp
int desiredTemp = 70;
@ -18,6 +18,7 @@ int desiredTemp = 70;
// Variables to Store errors:
int unrecoverableErr = 0;
int warning = 0;
int warned = 0; // support variable needed to prevent arduino from making second coffee after refill. this is a shitty hack and resets the board.
// Variables for cleaning and other maintenance
int dry = 0;
@ -31,6 +32,12 @@ int pumpRatio = 15;
// This next variable is used to get current "time" in ms and break out of while cycles that need a time limit safeguard
unsigned long startTime;
//_____________________________________________________________________________
void(* resetFunc) (void) = 0; // declare reset fuction at address 0
//_____________________________________________________________________________
void setup() {
// put your setup code here, to run once:
// first we set pins as I/O and initialize outputs LOW
@ -45,11 +52,14 @@ void setup() {
Serial.write("Arduino running :)\n");
}
//_____________________________________________________________________________
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(greenLED, HIGH);
// Check if unrecoverable error has occurred:
if (unrecoverableErr == 1) {
startTime = millis();
delay(100);
Serial.write("Error has occurred.\n"); delay(100); Serial.write("Check machine and restart\n");
digitalWrite(greenLED, LOW);
@ -58,7 +68,12 @@ void loop() {
delay(1000);
digitalWrite(redLED, LOW);
delay(1000);
// reset arduino after 30s
if (millis() - startTime == 30000) {
break;
}
}
resetFunc(); //call reset.
}
// check if data has been sent on serial from ESP or PC:
@ -68,29 +83,29 @@ void loop() {
serialRead();
String incomingData = readString.substring(0,4);
if (incomingData == "read") {
digitalWrite(greenLED, HIGH);
}
//if (incomingData == "read") {
//digitalWrite(greenLED, HIGH);
//}
if (incomingData == "rist") {
// set parameters for ristretto:
delay(100);
Serial.write("Ristretto\n");
pumpRatio = 12;
pumpRatio = 10;
}
if (incomingData == "espr") {
// set parameters for espresso:
delay(100);
Serial.write("Espresso\n");
pumpRatio = 15;
pumpRatio = 13;
}
if (incomingData == "long") {
// set parameters for lungo:
delay(100);
Serial.write("Lungo\n");
pumpRatio = 18;
pumpRatio = 16;
}
// check if the incoming data is "make":
@ -117,10 +132,15 @@ void loop() {
noCoffee = 1;
makeCoffee();
}
if (incomingData == "grin") {
// only grind
Grind();
}
if (incomingData == "pump") {
// run the code to just pump water:
pumpRatio = 12;
pumpRatio = 15;
Pump();
}
@ -136,10 +156,15 @@ void loop() {
if (incomingData == "heat") {
// only heat
desiredTemp = 85;
desiredTemp = 80;
Heat();
}
if (incomingData == "drop") {
// only drop
Drop();
}
if (incomingData == "clea") {
// clean machine
delay(100);
@ -152,9 +177,23 @@ void loop() {
Serial.write("S-cleaning done.\n");
}
}
// making steam:
while (digitalRead(vaporSensorPin) == HIGH) {
desiredTemp = 90;
Serial.write("Vapor heating\n");
delay(500);
Heat(); // Heat the boiler to vapor temperature
delay(20000);
if (unrecoverableErr == 1) {
break;
}
}
delay(milliseconds);
}
//_____________________________________________________________________________
// this is how we read the input
void serialRead() {
@ -166,6 +205,8 @@ void serialRead() {
}
}
//_____________________________________________________________________________
void Grind() {
digitalWrite(greenLED, LOW);
delay(100);
@ -180,18 +221,21 @@ void Grind() {
Serial.write("Grinding Done\n");
break;
}
if (millis() - startTime > 30000) {
delay(100);
if (millis() - startTime > 15000) {
Serial.write("Warning, grinding took too long!\n");
digitalWrite(grinderPin, LOW);
delay(100);
Serial.write("Out of Coffee?\n");
warning = 1;
warned = 1;
break;
}
}
digitalWrite(greenLED, HIGH);
}
//_____________________________________________________________________________
void Drop() {
digitalWrite(greenLED, LOW);
delay(100);
@ -204,6 +248,8 @@ void Drop() {
digitalWrite(greenLED, HIGH);
}
//_____________________________________________________________________________
void Heat() {
digitalWrite(greenLED, LOW);
digitalWrite(redLED, HIGH);
@ -213,9 +259,8 @@ void Heat() {
delay(100);
Serial.print(desiredTemp);
delay(100);
Serial.write(" C\n");
Tc = 0;
Told = -100;
Told = - 100;
// monitor temperature and adjust boilerPin as needed:
while (true) {
@ -227,7 +272,7 @@ void Heat() {
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
Tc = (T - 273.15);
if (millis() - startTime > 1000) {
if (millis() - startTime == 1000) {
Told = Tc; // support variable to store temp at beginning, so that we can be sure it's increasing
}
@ -240,7 +285,6 @@ void Heat() {
delay(100);
Serial.print(Tc);
delay(100);
Serial.write(" C\n");
digitalWrite(redLED, LOW);
break;
}
@ -253,7 +297,7 @@ void Heat() {
break;
}
if (millis() - startTime > 20000 && Tc - Told < 5) {
if (millis() - startTime > 20000 && Tc - Told < 1) {
delay(100);
Serial.write("p-Thermocouple: positioning or relay fault\n");
digitalWrite(boilerPin, LOW);
@ -277,6 +321,8 @@ void Heat() {
digitalWrite(greenLED, HIGH);
}
//_____________________________________________________________________________
void Press() {
digitalWrite(greenLED, LOW);
delay(100);
@ -293,6 +339,7 @@ void Press() {
while (true) {
delay(milliseconds);
if (digitalRead(wheelEndSensorPin) == HIGH) {
delay(900); // extra delay added to compensate for slightly incorrect endstop placement after repair
digitalWrite(wheelPin, LOW);
delay(100);
Serial.write("Pressed\n");
@ -309,6 +356,8 @@ void Press() {
digitalWrite(greenLED, HIGH);
}
//_____________________________________________________________________________
void unPress() {
digitalWrite(greenLED, LOW);
delay(100);
@ -316,7 +365,7 @@ void unPress() {
// Reset Press before every coffee
digitalWrite(wheelPin, HIGH);
delay(1000);
delay(1500);
digitalWrite(wheelPin, LOW);
digitalWrite(invertWheelPin, HIGH);
@ -342,6 +391,8 @@ void unPress() {
digitalWrite(greenLED, HIGH);
}
//_____________________________________________________________________________
void Pump() {
digitalWrite(greenLED, LOW);
delay(100);
@ -354,6 +405,8 @@ void Pump() {
digitalWrite(greenLED, HIGH);
}
//_____________________________________________________________________________
void makeCoffee() {
// code to make coffee goes here...
// It would be much smarter to break down complicated functions into subroutines: press/unpress etc...
@ -373,7 +426,7 @@ void makeCoffee() {
Grind(); // Grinding some nice roasted coffee beans!
}
// If grinder won't stop, coffee probably need to be refilled.
// If grinder won't stop, coffee probably needs to be refilled.
if (warning == 1) {
delay(100);
Serial.write("refill coffee and send cont command\n");
@ -416,14 +469,20 @@ void makeCoffee() {
delay(1000);
Press(); // Self explainatory
if (unrecoverableErr == 1) {
break;
}
desiredTemp = 85;
Heat(); // First we pre-heat the boiler
if (unrecoverableErr == 1) {
break;
}
if (dry == 0) {
digitalWrite(boilerPin, HIGH);
delay(1000);
delay(100);
Pump(); // Pump ratio (in seconds) will be read from serial input in final release
digitalWrite(boilerPin, LOW);
}
@ -436,8 +495,12 @@ void makeCoffee() {
}
delay(100);
Serial.write("Complete!\n");
delay(1000);
dry = 0;
noCoffee = 0;
if (warned == 1) {
resetFunc(); //call reset. I am ashamed of this, but it works.
}
break;
}
}

Loading…
Cancel
Save