DonCopal Posted April 30, 2016 Posted April 30, 2016 Hi, I am a complete mindstorms newbie, and I have a problem with programming it. Basically, I want it to drive between two black lines. I have already written a program for it, the only problem is that I have a loop that I need to connect two logical interrupts to. You can see it in the picture: I want the loop to be interrupted by both light sensor blocks' logic output, but it seems to be impossible. I cannot use an OR block because it would have to be after both light sensor blocks at the same time (it has to stop immediately after the sensor block). Is there any solution to this? Best regards DonCopal Quote
DrJB Posted April 30, 2016 Posted April 30, 2016 Not sure you logic is 'clear'. Now, I'm sure you have already seen programs for line following, and there are many versions out there, even with Adjustable PID gains. If the sensor/robot is to remain between two lines, then the logic should be that you should test for color transition only once. Are you using 2 light sensors? Maybe more details about exactly what you're trying to do will help answer your question. Quote
DonCopal Posted April 30, 2016 Author Posted April 30, 2016 I am only using one light sensor. Can you suggest me a code structure that you would use? It sould always drive on white background, when it hits the black lines, it shall turn two both sides to figure out which side is the right one and drive again. Quote
NXT45 Posted May 6, 2016 Posted May 6, 2016 Here is a very detailed program that you may be able to learn from. http://www.brickshelf.com/gallery/NXT45/MINDSTORMS/linefollow.rbt Quote
Serhio Posted May 8, 2016 Posted May 8, 2016 (edited) Driving between two lines with one sensor?I think it's something like voodoo magic. If you have only one sensor, then the only option - go along the border of one of the lines. First we need to measure the value of the sensor on the white and black to compute the midpoint, and drive, comparing the sensor value with this value. A value greater than - turn to the left, the value is less - turn right. Look for examples on the Internet. Programs to run on the line is already very much has been written. Edited May 8, 2016 by Serhio Quote
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.