LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on simple LabVIEW programming. Very new to labVIEW and myDAQ

Hello people, it's my first time asking here and I am hoping for some good answers. I did search up my questions first but I couldn't find it, maybe because they are very simple. 

 

PS: TLDR is down below this paragraph if you just want to help and not want to hear me babbling.

 

I'm currently in high school and I just did a robotics and control competition using labVIEW and myDAQ. The competition only gave us a pdf showing examples of program structures (open loop, closed loop, case structires, while loop). They are mostly about controlling through output (switches and phototransistors) which I did studied and analyzed well. We only practiced with less than two months time and I didn't expect what is going to happen in the competition. So the day of the competition came and I was starstrucked with the projects that they gave us. No sensors are required, only the basic use offmotors (propeller), lights and they need to be shut off/on and go reverse (motor) in a specific time. We are also required to repeat it three times and then stop. I was completely unaware of these and lost the competition (We finished 2nd place though, other teams were also stomped by the projects except for the team who came back from last years competition).

 

 

 

TLDR: To sum it up, I am asking for a program (or maybe also the mySTEM setup if you're kind enough) that do these things. I want to see where I did wrong and what not:

 

Task One: The Hand-Dryer.
• Turns the propeller (motor) on clockwise for three seconds with the right light on too (also for three seconds)

• Pauses for two seconds.

• Then turns the propeller (motor) counter-clockwise for three seconds with the left light on for also three seconds.

• Pauses for two seconds.

• The actions above must be repeated for three consecutive times. No more, no less.

• Stops the program, automatically.

 

 

Task Two PART 1: The Elevator

• Make a three storey elevator. They are not being specific and no sensors where asked. (I guess we just have to time the travel time to each floor? or use a switch? I used the single pole double throw switch from Fischerteknik but it wasnt perfect to the task..I got some programming issues on that)

• Starting from the first floor. The elevator (ie, the motor with the gearbox attached) needs to move up to the third floor and it should stay there for five seconds while the light (located on the third floor) and the buzzer (PS: Only one buzzer is used for the whole structure) should light and beep for three seconds.

• From the third floor, the elevator shoud move down back to the first floor and stays there for five seconds with the first floor light and buzzer on and buzzing for three seconds.

• From the first floor, move to the second floor and should stay for five seconds. Buzzer should sound and light should turn on too for three seconds.

• Then finally, from the second floor, goes back to the first floor and buzzer should sound and first floor light should turn on too for three seconds.

 

Task Two PART 2: Elevator

• With the same sequence as the one above, control the elevator using your keyboard input numbers (ie, if I put the number "1" in the program--which I have no idea how or where--it should go to the first floor. And if I type "3" the elevator should go to the third floor. Same goes for the second floor.

 

 

I know this is a long read but thanks for reading and to the people who will try and make this program, thank you in advance. Hopefully, I can learn more from here so I and my team can be ready for the next competition. Have a nice day!

0 Kudos
Message 1 of 2
(2,457 Views)

We will not write the program for you because you would not learn anything that way. We will guide you in the right directions and answer specific questions about LV.

 

First, if you have not already done so, work through the on-line tutorials for Getting Started with LabVIEW. They cover the basics like fundamental structures such as loops and how to control them. You will learn these much faster from the tutorials than from trying to learn while writing your competition programs.

 

Next, write down on paper what your program needs to do.  The descriptions of your tasks are the first level of this process. lower levels break down the items at the level above into simple or more basic elements until you get to things you knwo how to do.

 

Consider your Task One. The first requirement is to turn on the motor and an indicator with specific direction and timing values and then turn them off again. Break this down: How to turn on motor. (Make sure you also know how to turn it off.) How to set motor direction. How to turn on (and off) the light. How to determine elapsed time.

 

Then break these down again. To control the motor you probably need to configure one or more outputs on the myDAQ. You need to send certain data values to the myDAQ. You need to close the myDAQ session. Note that the configuration and close may only need to be done one time each at the beginning and at the end of your program while the sending of data values may occur many times as you turn the motor on and off several times and with different directions. If your motor speed can be controlled, you may need to send a speed value as well as on, off, and direction, even if you only use one speed.

 

After you have these descriptions written down (either in words or graphically as in a flow chart), then you can begin wirting the LV code to implement each part. For some parts it will be useful to write subVIs. The motor control might be a good place for this. It could have as inputs the myDAQ session identifier, an on/off boolean, a direction boolean, and a speed value.

 

This kind of hierarchical thinking and project planning can be applied to almost any kind of complex problem. It may seem like it takes extra time or that you do very little that is visible at the beginning, but you will have a much better understanding of the problem before you start writing programs or wiring motors. Over the duration of the whole project it likely would save time, reduce the amount of troubleshooting required, and make it easier to change thngs if required.

 

Lynn

 

 

Message 2 of 2
(2,444 Views)