Week 7 – Oliver

This week at coding we used the ultrasonic sensor. The ultrasonic sensor sends out high-pitched sound waves that we can’t hear to detect where a wall is. This will be used when we have to detect the tin can and push it out of the green circle. First we made a simple program to go towards the wall until it was 20cm away, then stop. Unfortunately, I had downloaded the Home Edition onto my laptop so I had to download the Student Edition, taking out a bit of coding time.

The “20cm away from wall” code.

The next challenge was to use “The Force” to control the robot. The pseudocode was: If the robot is more than 20cm away from the hand move forward, otherwise move backwards. We wondered why the code was not working, but we worked out that our sensor had to be plugged into port 4 to work because that was the default of the ultrasonic block.

Our next challenge was to use the exact same code from the previous challenge, except making the robot stop and stay still if it was between 15 and 20 centimetres away from our hand. For this we needed to use nested switch blocks, which is one switch block inside another.

An interesting thing that we found with the EV3 lessons site was that there was a discrepancy between their comments and the solution for the code. They had got the greater than and less than signs mixed up, making the comments not make sense.

This is last weeks result with our line follower. It is following the course that we will be doing for the Robocup Junior.

WORD OF THE DAY – Discrepancy – an instance of inconsistency or difference.