Question: Create an Arduino program that manages a washing machine where... a . There is a Fill Controlled by an RC circuit. b . There is
Create an Arduino program that manages a washing machine where...
a There is a Fill Controlled by an RC circuit.
b There is a Wash Controlled by an RC circuit.
c There is a Spinrinse Controlled by an RC circuit.
d Then are Empty timers between Wash and Spinrinse Controlled by an RC
circuit.
There should be a START that starts the process.
There should not be a pause if the door lid is open.
There should be an indicator light for each step in the wash cycle.
When the final spin is done a DONEBUZZER should sound, and a light should flash.
Use an Arduino timer using a timer interrupt to
There needs to be a RESET, which can reset the wash cycle.
When the Fill cycle is active, or the Rinse is active then a FILLVALVE is energized to
allow water into the washing machine. The FILLVALVE should only allow water to flow
for seconds.
You need to use an iC LCD display to state in English what state the washing machine
is in
The DONEBUZZER cannot activate while the EMPTYVALVE is energized.
The LCD will not print fill,wash, rinse,or done using this program. that was sent to me
C code
#include
int seconds ;
float fillValve ;
AdafruitLiquidCrystal lcd;
Pin assignments
const int STARTBUTTON ;
const int RESETBUTTON ;
const int FILLVALVE ;
const int EMPTYVALVE ;
const int DONEBUZZER ;
const int FILLLIGHT ;
const int WASHLIGHT ;
const int SPINLIGHT ;
const int DONELIGHT ;
State variables
enum MachineState
IDLE,
FILLING,
WASHING,
RINSING,
SPINNING,
DONE
;
MachineState state IDLE;
Timers and durations
unsigned long fillStartTime;
unsigned long washStartTime;
unsigned long rinseStartTime;
unsigned long spinStartTime;
const unsigned long fillDuration ; seconds for fill
const unsigned long washDuration ; seconds for wash
const unsigned long rinseDuration ; seconds for rinse
const unsigned long spinDuration ; seconds for spin
Initialization function
void setup
Pin initialization
pinModeSTARTBUTTON, INPUTPULLUP;
pinModeRESETBUTTON, INPUTPULLUP;
pinModeFILLVALVE, OUTPUT;
pinModeEMPTYVALVE, OUTPUT;
pinModeDONEBUZZER, OUTPUT;
pinModeFILLLIGHT, OUTPUT;
pinModeWASHLIGHT, OUTPUT;
pinModeSPINLIGHT, OUTPUT;
pinModeDONELIGHT, OUTPUT;
Initialize IC LCD display
lcdbegin;
lcdsetBacklight;
lcdclear;
Initial state of outputs
digitalWriteFILLVALVE, LOW;
digitalWriteEMPTYVALVE, LOW;
digitalWriteDONEBUZZER, LOW;
Loop function
void loop
Handle start button press
if digitalReadSTARTBUTTON LOW
Start the washing cycle if not already started
if state IDLE
state FILLING;
fillStartTime millis;
digitalWriteFILLVALVE, HIGH; Energize fill valve
digitalWriteFILLLIGHT, HIGH; Turn on fill light
lcdclear;
lcdprintFilling;
Handle reset button press
if digitalReadRESETBUTTON LOW
Reset the washing cycle
state IDLE;
digitalWriteFILLVALVE, LOW;
digitalWriteEMPTYVALVE, LOW;
digitalWriteDONEBUZZER, LOW;
digitalWriteFILLLIGHT, LOW;
digitalWriteWASHLIGHT, LOW;
digitalWriteSPINLIGHT, LOW;
digitalWriteDONELIGHT, LOW;
lcdclear;
lcdprintIdle;
State machine for washing cycle
switch state
case FILLING:
Check fill duration
if millis fillStartTime fillDuration
Move to washing state
state WASHING;
digitalWriteFILLVALVE, LOW; Turn off fill valve
digitalWriteFILLLIGHT, LOW; Turn off fill light
washStartTime millis;
digitalWriteWASHLIGHT, HIGH; Turn on wash light
lcdclear;
lcdprintWashing;
break;
case WASHING:
Check wash duration
if millis washStartTime washDuration
Move to rinsing state
state RINSING;
washStartTime millis;
digitalWriteWASHLIGHT, LOW; Turn off wash light
digitalWriteEMPTYVALVE, HIGH; Energize empty valve
lcdclear;
lcdprintRinsing;
break;
case RINSING:
Check rinse duration
if millis rinseStartTime rinseDuration
Move to spinning state
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
