LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to give change on a virtual vending machine?

Hi guys,

I need help giving change for my virtual vending machine. So I created a VI that dispenses a bottle of water for 15 cents. So I created a boolean/LED indicator that lights up when the correct amount is shown. However, if you were to press the dime function twice, that means you would have to give change, 5 cents to be exact. If you could give me some tips on how to dispense change that would be great. Thanks!

0 Kudos
Message 1 of 3
(3,669 Views)

I also attached my VI here

0 Kudos
Message 2 of 3
(3,668 Views)

Hello Kevinzhou225,

 

You can take a look at this Producer Consumer example of another vending machine. Open Producer Consumer Coke Machine.vi in the zip file attached to the webpage: https://decibel.ni.com/content/docs/DOC-2145

 

Then look at the bottom while loop, specifically the "Change" state of case structure for related code.

 

Thanks!

0 Kudos
Message 3 of 3
(3,586 Views)