Ken N Posted November 5, 2009 Report Share Posted November 5, 2009 Hi friends, I have a problem. please help me it below: Construct a VI that has 3 LEDs. When the VI executes, the first LED should turn on 1sec, then the 2nd LED for 2 sec, then the 3th LED should turn on 3 sec. Thanks Ken N Quote Link to comment
Ton Plomp Posted November 5, 2009 Report Share Posted November 5, 2009 Hi Ken, could you post the code you have written allready? This looks like a homework assignment, and I don't feel like giving freebies. Ton 1 Quote Link to comment
jcarmody Posted November 5, 2009 Report Share Posted November 5, 2009 Give me your block diagram, wire-master, and I shall give you mine... 3LEDs.vi 2 Quote Link to comment
hooovahh Posted November 5, 2009 Report Share Posted November 5, 2009 Give me your block diagram, wire-master, and I shall give you mine... Awesome Quote Link to comment
jcarmody Posted November 5, 2009 Report Share Posted November 5, 2009 My first submission wasn't scalable, this one is (up to 32 LEDs). I have the day off today! nLEDs.vi 1 Quote Link to comment
gb119 Posted November 5, 2009 Report Share Posted November 5, 2009 My first submission wasn't scalable, this one is (up to 32 LEDs). I have the day off today! Obfuscated LabVIEW code challenge anyone ? Rules something like: Should be programmable using the base LabVIEw 2009 (or earlier) system with no scripting and able to be forward compatible code (i.e. no LabVIEW vi's represented as binary constants) and no private property or method nodes. May use vi's found in vi.lib on the base system but no other dependencies (i.e. no calls to external dlls etc). Should have undergone code cleanup (i.e. no obfuscation by hiding code under structures or other boringly simple techniques). Any other restrictions ? Winner is the code that performs to the specification but in the least obvious and most contorted way possible. Quote Link to comment
jcarmody Posted November 5, 2009 Report Share Posted November 5, 2009 I'm hoping that Ken N replies to this post. If he goes away before getting help, I shall be forced to taunt him a second time! Quote Link to comment
Yair Posted November 5, 2009 Report Share Posted November 5, 2009 We had some obfuscated code in this thread. Quote Link to comment
gb119 Posted November 5, 2009 Report Share Posted November 5, 2009 We had some obfuscated code in this thread. Sure, but new features means new opportunities and I think writing obfuscated code that remains obfuscated even after diagram cleanup removes a whole classnon-topological obfuscation. Quote Link to comment
Ken N Posted November 6, 2009 Author Report Share Posted November 6, 2009 Hi Ken, could you post the code you have written allready? This looks like a homework assignment, and I don't feel like giving freebies. Ton Quote Link to comment
ShaunR Posted November 6, 2009 Report Share Posted November 6, 2009 I'm hoping that Ken N replies to this post. If he goes away before getting help, I shall be forced to taunt him a second time! Your mother is a hampster, and your father smells of elderberries? 1 Quote Link to comment
jcarmody Posted November 6, 2009 Report Share Posted November 6, 2009 Ken, The point Ton and I were trying to make is that you need to demonstrate that you've made an effort to solve this problem yourself. If you're asking for our help you need to explain what you've tried and where you're having trouble. You won't learn anything if we do the work for you. Besides, you won't even be able to recognize if someone gives you an obfuscated solution (which has happened on this forum). We don't know anything about you. For all we know you're a college student with a homework assignment and you're trying to get us to do it for you. If this was the case, and you don't learn the material, you may graduate and be hired by my company and be assigned to my team. I'd have to do your work for the rest of my life. I'm not interested in that. Jim Your mother is a hampster, and your father smells of elderberries? Yes, or "I [shout C syntax] in your general direction." 2 Quote Link to comment
hooovahh Posted November 6, 2009 Report Share Posted November 6, 2009 When ever obstruficated code is given to a student for a homework assignment, I always assume they just hand it in anyway and come up with an excuse to the teacher on why they did it that way, if they even look at the block diagram. And if they don't look at the block diagram then they someone like Ken could turn in the password protected code anyway. I never had a LabVIEW class but for Java we had to printout the source as well and send it in. I know of several ways to print out LabVIEW source but none seem like a good idea. But I do appreciate obstruficated code, especially when I can't understand what is going on but the end result is correct. Quote Link to comment
Ken N Posted November 6, 2009 Author Report Share Posted November 6, 2009 Hello, I am sorry you all. Yesterday morning I tried to send my writing code by Add Reply button and Attachment , but I don't know why it doesn't come on Forum. I am not a college student. I have been learning labview for a couple weeks by myself because I just bought a book "LEARNING LABEVIEW 6i". I have gone through some chapters and do alot of problems. But this is a problem I couldn't firgure it out. I used Sequence Structure and each sequence is for each LED and timer. I enclosed the attachment below. Once again, I am a new learning. Thanks K EXE3LED.vi Quote Link to comment
hooovahh Posted November 6, 2009 Report Share Posted November 6, 2009 I really don't want to come across as mean, but you say you've been learning LabVIEW for a few weeks, and you say you can do alot of the problems in the book...but you didn't change the state of the boolean in your sequence structure. You may want to review some of the chapters you've gone through and play around with some of the VIs you've already made. One pitfall of using a book is that you might just be going through the motions, putting down components and wiring them up without understanding how the code works. To get the result you're looking for wire a True or a False to the boolean in each state of the sequence. This will change the value seen in led1, 2, and 3. If you're looking to turn off leds (like when led2 comes on turn off led1) you'll need to create a local variable for led1, and when led2 turns on wire a False to led1. Quote Link to comment
Ton Plomp Posted November 6, 2009 Report Share Posted November 6, 2009 Hello, Once again, I am a new learning. Hi Ken, To turn on the leds feed them with a "true" boolean. To turn them off place a local and feed them with a 'false' boolean. I saw you use LabVIEW 5.1, it might be handier if you post images of your code, since LabVIEW 8+ can't open these VIs. Also try to code without a sequence structure. ton Quote Link to comment
jcarmody Posted November 7, 2009 Report Share Posted November 7, 2009 I used Sequence Structure and each sequence is for each LED and timer. I enclosed the attachment below. I think I misunderstood what you were going for, and I didn't even look at your LabVIEW version so you probably didn't get to run my examples. I turned the LEDs off at the end of their appointed times. Here's how I did it. Those are Elapsed Time express VIs. I felt bad after writing this because it would require more code to add more LEDs, and it would get very ugly very quickly. I wrote this to go up to 32 LEDs without changing the code. I think it would be easy to add even more, but I'll leave that up to you. That's a Time Delay express VI. The thing I really don't like about this approach is that it can't be stopped, only aborted. PS - the second loop exists only because I HATE local variables. Quote Link to comment
Ken N Posted November 7, 2009 Author Report Share Posted November 7, 2009 I think I misunderstood what you were going for, and I didn't even look at your LabVIEW version so you probably didn't get to run my examples. I turned the LEDs off at the end of their appointed times. Here's how I did it. Those are Elapsed Time express VIs. I felt bad after writing this because it would require more code to add more LEDs, and it would get very ugly very quickly. I wrote this to go up to 32 LEDs without changing the code. I think it would be easy to add even more, but I'll leave that up to you. That's a Time Delay express VI. The thing I really don't like about this approach is that it can't be stopped, only aborted. PS - the second loop exists only because I HATE local variables. Hi Jcarmody, Thank you for your help. Your diagram is a little bit high to my understanding, but I am going to study your diagram and I hope I will understand your way very soon. KN Quote Link to comment
jgcode Posted November 7, 2009 Report Share Posted November 7, 2009 Yes, or "I [shout C syntax] in your general direction." "I told them we already got one..." Quote Link to comment
crelf Posted November 7, 2009 Report Share Posted November 7, 2009 "I told them we already got one..." "I code in your general direction!" 1 Quote Link to comment
jcarmody Posted November 7, 2009 Report Share Posted November 7, 2009 [...] I am going to study your diagram and I hope I will understand your way very soon. Ask any questions you have. The on-line help is very good and single-stepping through the code, probing as you go, will help. Quote Link to comment
ShaunR Posted November 7, 2009 Report Share Posted November 7, 2009 (edited) A different approach just to show theres more than one way to skin a cat ferret Edited November 7, 2009 by ShaunR Quote Link to comment
jcarmody Posted November 7, 2009 Report Share Posted November 7, 2009 A different approach just to show theres more than one way to skin a cat ferret Me gusta mejor. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.