Skip main navigation

Define robot movement as it sees light

Watch how you can define robot movement as it sees light by using one of the Begin Robotics simulations, before having a try yourself.
And 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.
So 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.
You 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.
And 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.

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.

This article is from the free online

Begin Robotics

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education