Jump to content
THIS IS THE TEST SITE OF EUROBRICKS! ×
THIS IS THE TEST SITE OF EUROBRICKS!

Recommended Posts

Posted

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:

post-159786-0-13986600-1462017642_thumb.jpg

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

post-159786-0-13986600-1462017642_thumb.jpg

Posted

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.

Posted

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.

Posted (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 by Serhio

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...