LOOP: Lego Object Oriented Programming

LOOP: Lego Object Oriented Programming

Image by jurvetson
Five programming blocks were connected by a young boy. Ports B and C are connected to left and right wheels.

What does this compact program do, and how?

12 thoughts on “LOOP: Lego Object Oriented Programming

  1. Sensors which generate light connected to wheels… something to do with brakes? With car lights responding to the wheels’ movement (stop = on / move = off )? The microphone can mean "output" there? like the "Run" comand? and the last is a loop comand as you mentioned, for this function should continually be working. That is my guess… However I like Stenz’s karaoke theory better. =) (I downloaded this virtual LEGO builder once long ago… looked as amazing as any 3D modelling software and even more complicated for you got to understand what you are doing. As I am not sucha LEGO girl, I uninstalled it. 😛 ) (( 7 years old and doing this… just give this boy a pocket manual on PHP he builds you a web2.0 site! ))

  2. stenz – you are wise for your age. But the light sensor is pointing down, away from the sun… Alieness – you are right about the contnuous loop, but the microphone input ends the loop.

  3. So I have understood it all the inverse way? Perhaps the lights turn ON when the wheels MOVE . So these can be actually front lights to enlighten the way, and not brake lights. And so if the microphone is "input"… it may be a device to send comands, ej: HALT -(microphone = True) wheel stop, end loop, lights go off- or GO -(microphone = False) wheels turn, lights are on, continue loop until otherwise- ? I give up! x_x

  4. The tab at the top says "Follow the track" as the name for this routine. You say the sensor is pointing down, so presumably at the track. If the track has colored lines, then it would seem that the program says to move forward at half speed, shining a light down (it says generate light) until it has passed some threshold (50) at which point it then turns left, until it sees what appears to be the same threshold as before. It repeats this until it hears something, probably a clap. Reminds me of an assignment my dad gave his students in what would have probably been 1994, to build a robot that would go into the gym of the college and locate a tennis ball wrapped in aluminum foil. They had a chassis for a remote control car and some sensors. None of them could do it, but this looks like something a lot closer to that sort of thing.

  5. The light sensor generates light, until a light source is detected at greater than 50% (of the measuring capacity). The object moves forward and turns until the condition is met at which point it rests until the measured light drops below 50% again or the microphone breaks the loop. Maybe?

  6. I’m going to piggyback on Jonathan0766. I think its for a car on an oval race-car-like track, with a black-asphalt road and white concrete sides. The car goes forward at normal speed as long as the sensor picks up a black road underneath. Once it sees a bright border, it slows down and turns to the left (in a counter clockwise track). Once it sees black again, it goes forward at normal speed.

  7. Let’s see…robot moves forward at ~50% of full speed until light sensor detects >50% light level (white or light grey color?). It then rotates left and ends the rotation when the light sensor again detects >50% light level (reflected, since it’s also generating light). Repeats until sound sensor detects a specified decibel threshold. Perhaps? I’m guessing this thing goes from point A to point B, tracking a strait line, rotates 180 degrees when the track runs out and starts over again until a sound beyond the decible threshold brakes the infinite loop. I take that back. Thinking through this a bit more, I think it simply follows a circle or oval track, counter clockwise. The slow 180 degree rotation doesn’t make sense for a strait line back and forth, since it would over-rotate the turn (until detecting >50% light), so it must track an elliptical or circular track, right? I suppose this is a vote for edlimphoto’s guess.

  8. Bingo Stenz + edlimphoto & chadh !! Collectively, you nailed it, in every detail, even down to the test path shape. Here’s the video. When my son first built the robot, I asked if he could make it trace a rectangle around one of his huge space books. He approached it as: go straight a precise distance; then turn 90° left; then go straight a precise distance and turn 90° left again, etc. Though many iterations on travel length and turn time, he got it to work, but over many iterations, the fixed instructions inevitably drifted, and without error correction or feedback, the dead-reckoning algorithm could only go so far. So then I asked if he could follow the curved black line on the test track, as well as any black line I might draw on a page, and this is what he came up with. Good Robot

Leave a Reply