LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Code for vending machine

Solved!
Go to solution

these are the codes on which i have worked out 

Download All
0 Kudos
Message 11 of 21
(6,124 Views)

These are first glace items.  I haven't dug into your code at all yet.

 

Do not delete the labels.  Make them something intuitive.  You can hide the labels on the front panel.  But they are essential to the block diagram.

Save your state enum as a type def.  Then you can add/subtract cases to the enum without needing to change all of the other enums.

 

I'll try to dig in a little more when I have some time.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 21
(6,115 Views)

could you please do the code complte code and post me as soon as possible

 

0 Kudos
Message 13 of 21
(6,109 Views)

@vendingmachine wrote:

could you please do the code complte code and post me as soon as possible

 


No.  We will not do your work for you.  How would you learn then?  We have our own work to do.  We are willing to help you do yours.  But we will not do it for you.

 

Oh, if you have it (I'm not sure when version you are using (Base or Pro)), use the Event Structure to handle the button presses.  That will make it easier.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 21
(6,101 Views)

@vendingmachine wrote:

could you please do the code complte code and post me as soon as possible




This is a help forum, and not a code writing service. 😮

0 Kudos
Message 15 of 21
(6,097 Views)

After you have implemented crossrulz's suggestions, the next thing I would do is use an event structure to handle the buttons.  You could setup one case of the the state machine to contain the event structure.

 

You are more likely to get help if you ask specific questions about your code or LabVIEW. 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 16 of 21
(6,096 Views)

rarther than going for event structure we can cmplte it using case structure 

0 Kudos
Message 17 of 21
(6,086 Views)

@vendingmachine wrote:

rarther than going for event structure we can cmplte it using case structure 


You can, but it will be less intuitive, harder to read, harder to expand, more complicated, use more processing, and probably a few more bad things.  If you have the event structure, use it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 18 of 21
(6,081 Views)

Event structures and case statements are very different things. An event structure is ideal for user interfaces since you define actions for specific events such as a button press. The event structure will be ideal and not execute until an event occurs. In almost all cases the event structre is contained in a while loop.

 

A case structure is simply a structure which allows you to execute a specific piece of code based on the selector value. A case structure placed inside a while loop is the basic architecture needed for a state machine. If you use a while loop with a case structure to handle user events you create a polling system. Polling systems must continually run and check for specific conditions. It will be using up CPU cycles as long as it is running. Case structures are not very good for handling your user events because of this.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 19 of 21
(6,080 Views)

 

I have only ATM, Car wash, Sprinkler, Traffic light and Boiler CLD questions. I want to practice more, so I need question paper of Coffee machine, Microwave oven, Security system, Thermostat, Treadmill, Vending machine. 

 

 

Can anybody help me on this?

 

Thanks

0 Kudos
Message 20 of 21
(5,481 Views)