04-01-2024 01:29 PM - edited 04-01-2024 01:30 PM
I am currently a student trying to code this LabVIEW program however, I am running into an issue when it detects red.
The first time it detects red, it follows the program (the song is just there to let me know its reading correctly). The 2nd time it detects red, it follows the "yellow" or "green" program. The 3rd time it sees red it just turns off the main motor.
Port A - medium motor used to spin to sort.
Port B - big motor turning a conveyor belt continuously for 240 seconds.
Port 1 - color sensor
This is a color sorting/reflected light sorting program.
***THIS IS FOR A GRADE***
I am not looking for the answers just checking to see if the whole program is written incorrectly or if I'm missing one vital thing.
I am trying to understand why it tries to do a different program once it detects red again.
I have attached my test code so far.
Thank you for any and all feedback, this is my first time using LabVIEW and its been fun up until this issue.
04-01-2024 03:52 PM
I don't have the Lego stuff installed so I can't see everything you're doing but I suspect the problem is that you have two separate sections of code here that run at different times than you think:
The upper section and the case structure are connected together, so the "Port 1 detect" VI runs, and then its output allows whichever case it matches to run.
The lower section that looks like it sets power, waits, and then brakes is not connected to it at all.
I don't know what order you want these to run in, but you need to connect a wire of some kind from one section to the other to set which order they run in. You may need to put them inside a Flat Sequence and connect them with a dummy wire if there isn't any wire you can use naturally.