04-04-2016 07:47 PM
natas,
here's my pseudocode. It's not perfect. parallelism makes this harder I guess.
loop{
turn green LED ON
turn red LED OFF
ledBool= !ledBool
if (ledCount == 1){
turn yellowLED ON
delay 5 seconds
turn yellowLED OFF
flash orange LED 10 times (eat up 5 more seconds)
turn greenLED OFF
turn redLED ON
flash ornageLED 4 more times
else
delay 10 seconds
}
set greenLED OFF
set redLED ON
delay 10 seconds
}
04-04-2016 07:57 PM
Sorry for sounding so daft, but I can do this with only one loop? I'm seriously running out if ideas guys.
04-04-2016 08:06 PM
Wow breakthrough, I think I might have it. Don't give me an answer yet, please. haha
04-04-2016 08:31 PM
Finally! This seems to work pretty well. I couldn't do it with just one loop, but close. Any advice on how to make this more efficient would greatly appreciated.
Thanks guys!
04-04-2016 08:44 PM
Now go back and look at the spoiler in my last post.
NOTE: there is a missing wire! left for the student to debug
04-04-2016 09:14 PM
Thanks Jeff I didn't even see that there. Not sure what the arrows pointing backwards do. Looks kind of like an op-amp in a feedback loop. I'm going to try out your circuit program (haha) and see how it differs. Is there a reason why yours is better than the one I made?
04-04-2016 09:25 PM
@analogPumpkin wrote:Thanks Jeff I didn't even see that there. Not sure what the arrows pointing backwards do. Looks kind of like an op-amp in a feedback loop. I'm going to try out your
circuitprogram (haha) and see how it differs. Is there a reason why yours is better than the one I made?
Those backward arrows are "Feedback Nodes." They are found on the Structures pallete. They operate simillar to Shift Registers (The differences are moot for this use case.) In fact, you could right-click them and select "Replace with Shift Register" and have equivalent code in this case.
@as to "Better" there is one HUGE difference. Your vi must complete the for loop meaning, it could take up to 40Seconds afer the "Stop" button is pressed before the vi actually stops. Most users are going to pound their mice agressively when that happens. My vi will exit within 1/2 second (Honestly, this is STILL too long! ideally we should use @ a 200mSec wait and adjust the Q&R divisors accordingly)
Getting familliar with all of the functions on the pallates takes time and practice. Nice work. Read the help in the floating window (Hit Ctrl+H to bring up the help window) and don't be afraid to keep posting.
04-05-2016 02:49 AM
@analogPumpkin wrote:Finally! This seems to work pretty well. I couldn't do it with just one loop, but close. Any advice on how to make this more efficient would greatly appreciated.
You can remove the inner For loop and use a Quotient and Remainder of the remaining While loops "i" to get your "loop# 1 to 40".
That way you'll also get a Stop response time of <1sec.
Good job.
/Y
04-05-2016 09:12 AM
A funny thing happened on the way to school:
Although the OP learned a lot and made great efforts! I did not read and understand the specifications in the first post. Hence the proposed solution in message 10 ABSOLUTELY missed.
This is my fault for not following a clear spec! Post 10 is hereby revolked of its solution and an alternate snip is below