Hello, here is an example of what I am trying to do. I am trying to use cent and nickel for when I am selecting either I want a soda or a snack. The cent and nickel should be use when soda or snack is been selected. Please see the following simulation. I am tried so many different things but I just can't get it. Can someone help?
It will help me so much thank you!
Solved! Go to Solution.
Some advice to get you started:
See how far you get. 😄
Thanks for the reply.
Can you please help me? I am struggling so much with this.
I want to turn on the boolean indicator on when I reach certain values as shown on each case but I can't. I don't know why. Additionally, I want to add values that already exist. Say when I press one cent and then nickel it should be .06 cents but I don't know how. This is a little difficult to me. Please help!
You only need one wait.
Get rid of all the local variables! Get rid of all that silly code. For example an "equal true" just returns the input unchanged, so all you need is the wire (see also). One shift register anchored in the outer loop is sufficient to carry the current balance. Compare the value with the item prices to see what can be dispensed.
Attached is a very simple code skeleton that increments the balance whenever one of the coin buttons is pressed. It can be made even simpler and more scalable, but that should get you started. I am also giving you some hints how to expand the code. See how far you get.
I also want to dispense whatever money was inserted on the indicator "Inserted money." When I cancel I want my money back and the on "Inserted money" should indicate zero and whatever money was inserted should be display on change money. How would you do that?
Well, it's just another state. Of course you need to make sure that the outer loop does not stop when "cancel" is pressed (as it currently does). The program should go back waiting for coins.