need help to program a line tracker

I’m trying to program a line tracker in easy c v5 for driver control so my intake can stop moving once the line tracker gets a sense of the ball. can anyone help me with the program

@Jimmy The Robot
Our team is implementing a similar feature on our robot. I am using robotC to program so I cannot help you with the syntax, however I can help with the theory. We have an intake with multipe stages powered by different motors. We use 2 seperate buttons on the controller to dictate the movement of the intake. The first powers all stages of the intake, regardless of sensor input(our “shoot” button). The second button first checks sensor input for a ball in the final stage, and then moves the intake accordingly(our “intake” button). If a ball isnt detected, it moves all stages until one is, then only powers the lower stages.

The advantage of this system is the ease of use for the driver. If you plan on using line sensors, I recomend that you ensure your intake will not jam/burnout if a ball is stopped in later stages of the intake.

Thanks for the help man it give me a idea

Help me out woth syntax pls

@David_5839A In robotC? I don’t know easyC.

Yes robotc

I would do something like

if (line sensor > ball) { // checks if line sensor is not sensing a ball
JoystickDigitalToMotor ( x, x, x, x, x, x, x) //Allows intake to be run by a button
You will have to figure out the correct sensor values and translate it to block code and input the button to motor values, but otherwise this should work. If you need more than this I can message you with a screen shot. However I think that having a line sensor at every position of the ball would be nice. Then you could do a lot more automation (ex. When “fire” button is pressed, fire all balls in the intake.)

Ok. The shoot button should be pretty simple based on my description. The intake button looks like this
If(button pressed){
If(no ball in final stage){
Run all stages
Run all but last stage
Last stage =0

Sorry for the poor formatting, I’m on my phone. It is important that you set the last stage to 0 in the else statement, otherwise it will not turn off when the sensor “sees” a ball. Let me know if you need any other help!