Week 6 – Josh

Today at coding class we cracked into our overall goal, making a line follower.  First we had to learn about switch blocks which is really the program asking the robot a question about its surroundings and answering yes or no.  E.g is the colour sensor on a black line; yes turn right, no turn left.

We then got stuck into our first challenge.  The pseudocode challenge guidelines are as follows.

Step 1: Write a program that follows the RIGHT edge of a line.
Hints: If your sensor sees black, turn right.  If your sensor sees white, turn left.  Use loops and switches!
Step 2: Try it out on different lines.  Did your line follower work the same on straight and curved lines?
Step 3: If not, instead of turn Steering = 50, try smaller values.
Is it better on the curved lines now?
After some trial and error I got the robot to follow the line but when it got to a sharp turn it lost the line.  After adjusting the speed and steering I got it to work.  (I slowed down the speed and increased the steering).  This was a very interesting task as everyone used something different to steer to start with.  I used ‘On’, but the others used rotations, time and degrees.  We ended up all finishing on ‘On’.  The picture of the code is to the left .  We then checked the solution and it was very similar, the only real difference was the speed and steering.
The second challenge was pretty much an add on to the last task as we just had to make it stop when the touch sensor is pressed while the same line following code applies.  As you can see we changed the repeat forever to until touch sensor is pressed.  This was a very good lesson and is setting us up for our final goal.
Our Mindstorm Adventures Continue.