/*
* Title: washing machine
* Author scarlett Edwaards
* Date: 01/05/23
* Version: v1.0
* Purpose: how to make a washing machine
*/
#include <Stepper.h>
#include "pitches.h"
#include <LiquidCrystal.h>
const int buzzerPin = 13;
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
LiquidCrystal lcd(12, 6, 5, 4, 3, 2);
void setup() {
Serial.begin(9600);
pinMode(buzzerPin, OUTPUT);
lcd.begin(16, 2);
lcd.print("Washing Ready");
delay(2000);
lcd.clear();
lcd.print("Put in Clothes");
delay(1250);
lcd.clear();
}
void Wash() {
myStepper.setSpeed(60);
myStepper.step(stepsPerRevolution);
delay(500);
myStepper.step(-stepsPerRevolution);
delay(500);
}
void HeavyDuty() {
myStepper.setSpeed(70);
myStepper.step(stepsPerRevolution);
delay(450);
myStepper.step(-stepsPerRevolution);
delay(450);
}
void DelicateWash() {
myStepper.setSpeed(40);
myStepper.step(stepsPerRevolution);
delay(600);
myStepper.step(-stepsPerRevolution);
delay(600);
}
void Sound() {
noTone(buzzerPin);
tone(buzzerPin, NOTE_C4);
digitalWrite(buzzerPin, HIGH);
delay(3000);
noTone(buzzerPin);
digitalWrite(buzzerPin, LOW);
}
void loop() {
delay(3000);
DelicateWash(); // Change the mode by swapping the words with other washes like DelicateWash or HeavyDuty
Sound();
}