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

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now