LI: To practice coding using binary, mBots and block code.
Today for tech we used our knowledge of binary code as well as block coding and mBots.
We made our mBot recognize color paths by coding it to have an infra-red sensor. It has two sensors that recognize the colours inside of light rays. For this lesson, we needed to be able to count to three in binary because the binary of the first sensor is 01, the second sensor is 10, and when both sensors are enabled the code is 11 as well as when both sensors are disabled the code is 00 (we need to know this for this lesson).
If both sensors are on the black line they become 00 because there are no light rays enabling the sensors. If the left sensor is on a black line and the right sensor is on a white line the code becomes 10. If the right sensors are on the black line and the left sensors are on the white line the code becomes 01. If both sensors are on a white line the code becomes 11.
When the code is 00, the mBot moves forward. When the code becomes 10, the mBot turns left. When the code becomes 01, the mBot turns right. When the code becomes 11, the mBot moves backwards until it finds a black line.
I found this task interesting and informing because I found out not only how to make an mBot move in a certain way but also how to simplify code to make it easier to import on the mBot.