Skip to 0 minutes and 1 secondAnd now for the second exercise this week. Again, it's about commanding the robot-- this time, to respond to light sensors, so that the robot can steer towards lights.

Skip to 0 minutes and 16 secondsSo here is the web page. We've got a robot. These beams, here, reflect whether or not the robot can see a light or not. And you've got narrow beams, like this, but you can also have wider beams, like that. And the idea is you programme the robot to move around so that it can, for instance, steer towards one of these two lights. So what does the robot do when it can't see a light? What does it do when it just sees a light on the left or on the right? And what should it to when the light is much closer on the left or the right? So you're setting up left and right speed pairs, as before.

Skip to 0 minutes and 54 secondsYou have the option to reverse the left motor wires. And when you're happy, you can press Start and the robot will move. You can put it back into its original position, if you want to.

Skip to 1 minute and 7 secondsAnd again, I've moved the web page around so that you can't see what the numbers are. But this is just to show you what I mean. What should it do? Here, the robot's going. It's starting to detect a light. Now turns towards it. Gets closer and closer, and it stops. Can you do that? What is the effect if you've got wider beams? Can you get a robot to steer towards it, like that, but to veer away at the last minute? These are all possible. Have fun.

Define robot movement as it sees light

As we discussed in Step 2.9, some robots can have light sensors to sense if an object is nearby. This video, shows you how to define the speed depending on the strength of the beam used to detect objects.

Once you’ve watched the video, go on to the next step to have a go yourself!

Don’t worry if you are unable to do the exercise yourself. You can watch how Richard approaches the simulation in Step 2.21.

Share this video:

This video is from the free online course:

Begin Robotics

University of Reading