Relay Set Time

How do you make a relay run for a set amount of time, then stop? I want to use this for autonomous. I know how to set it for forward/reverse, but the timing aspect is tricking me up.

Thanks

Look at the frcmastery.com video “Step 5 - Turn on Autonomous Mode”. It walks through the default (non game specific) autonomous code, which runs the drive train for certain periods of time. It shouldn’t be hard to do something similar for a relay.

I figure i can try that out. Thanks

Just make a while loop, and stop the loop after a certain amount of time.
The is an example to it in the default project WITHOUT game code.
Also, if you do so, don’t use constants at first but controls, because it’s much easier to change those numbers in controls because you don’t need to send your project all the time.

Thanks. I will try that too. I want to use the sensors though. So if a make something with a while loop to raise our arm, where do I put it in the default code WITH game code

Just make a case structure in the auto vi and the first case will be probably the line tracking code, the next case will be the arm and so on…

Also u don’t have to use the default line tracking code to work with sensors, i made a much simpler code using only 2 sensors because of some problems that we had with the third sensor, and it works really good.

Can you send me your simple version of the line tracking code? I don’t really like the default one because of all the different modes it has within. We aren’t planning on changing what line we go down like the default code shows. We are probably gonna go down the ones on the side.

Thanks

Sorry, i don’t have the lab computer on me now, i will try to send the code to u later.
U can create a very simple code using only 2 digital outputs (the sensors) a bunch of cases and a while loop with a stop condition when both digitals are true.
I am working with labview only for 2 month and those are very simple functions.
so i think u can make it, if you think about those functions for a while.

Again… i will try to send you the code soon as i get on the computer, but it will be only in couple of daysץ
Also, there are plenty of teams using only timers in the auto mode and it works pretty good, so u don’t really need timers.

Can you send me a copy of this code as well? Thanks

If you’re interested, I’ve attached a simpler line-following program. I tried to add a ton of comments so that modifying it is easier. PM me if you have any questions.

Note that it has nothing to deal with the Y or the diagonal bits. Also, the robot may not be aligned when it stops, so be prepared to deal with that. We have a mecanum base, so if you need some code for that I can send some your way. It’s not very clean though :slight_smile:

Tank Drive Autnomous Sample.vi (19.5 KB)


Tank Drive Autnomous Sample.vi (19.5 KB)