Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an Arduino code that is a vending machine it must: Simulate dispersement of a beverage by lighting up an LED. Each beverage will cost

Write an Arduino code that is a vending machine

it must:

Simulate dispersement of a beverage by lighting up an LED.

Each beverage will cost 75 cents.

Only quarters and dollar coins are accepted. Simulate this by using two momentary button switches, one for dollar coins, and the other for quarters.

Exact change must be given. Simulate change being dispensed with another LED.

Develop your state machine diagram first. Assume that the following states exist:

WAIT

ONECOIN

TWOCOIN

CHANGE

DISPENSE

For each of these states:

WAIT will look to see if either the quarter switch OR the dollar switch is pressed. You may assume that both cannot be pressed at the same time. If a quarter is inserted, move to ONECOIN. If a dollar coin has been inserted, move to CHANGE.

ONECOIN will look to see if another quarter is inserted and if so, move to TWOCOIN. It should ignore if a dollar has been inserted at this point.

TWOCOIN behaves the same as ONECOIN as it watched for another quarter to be inserted and ignores a dollar coin. If one quarter is inserted, then it will go to DISPENSE the beverage.

If a dollar has been inserted, then CHANGE should light up the coin return LED and then DISPENSE. The coin led should remain on until the system returns to wait.

DISPENSE should light up the dispensed beverage LED which should remain on until the system returns to wait. Remain in DISPENSE until BOTH buttons are pressed, which will return the system to WAIT.

Circuit must look like:

image text in transcribed

TI" O UNO ARDUINO 31 2323

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions