12-08-2017 04:10 PM
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.
12-08-2017 04:45 PM
Some advice to get you started:
See how far you get. 😄
12-09-2017 05:05 PM
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!
Thanks!
12-09-2017 05:05 PM - edited 12-09-2017 05:06 PM
Thanks!
12-10-2017 03:23 AM
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.
12-10-2017 03:35 PM
So kind of you! Thank you very much. Will do my best.
12-10-2017 04:28 PM
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?
12-10-2017 08:40 PM
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.