Today’s topic is “Car, movement and traffic”. We will code four tasks, which teach children about the speed and movement! With these tasks you will need both Lab and Robot kit.
Exercise 1. Ready, steady, GO!
Move Robot kit with the Lab’s slider. Program Robot kit to move faster and slower with slider!
Remember to set the direction first before turning on the motors. I also recommend to turn motors on only for a short period of time, i.e. shorter than a second. In that way the Robot kit turns off the motors immediately after Slider’s values are below one.
Exercise 2. Count how fast your robots go!
Measure one meter on the floor and put tape strings on the beginning and the end of it. Drive the distance first with Slider’s value 100 and after that set the slider value 40. On which time robot was faster? Calculate how long it took with both times. You can use RobboScratch as a timer! Try code below.
When Robot kit crosses the first tape, click the flag and when the last tape is crossed, press the space key. I recommend that this exercise is made with pairs, so it will be easier to control both the robot and the timer. Would you guess a way how to calculate the time using the Robot kit’s sensors?
If you want to calculate Robot kit’s speed, change only one part of this code! Check out the answer below.
The number one is used as a numerator, because the distance is one meter!
Exercise 3. Let’s build a Speedometer!
Program Robot kit to a speedometer! You need two proximity sensor for this exercise. Note that the Robot kit includes only one proximity sensor. If you do this with students, I recommend to do this in pairs.
If you look the picture below, you will get a better understanding about how speedometer works. The idea is to move an object front of the sensors. The first sensor activates the timer and when second sensor activates, it announce the object’s speed.
Put proximity sensors on places 2 and 5. Measure the distance between proximity sensors (7 cm).
About proximity sensors: It is good to note that proximity sensors contains photo diode and infrared led. They read reflecting light and objects reflect light differently. I recommend to try with different objects which ones reflects light well, i.e. give high sensor values. It is also recommend not to program under reading lamp or similar light source, because the light could affect proximity sensors values.
When you are ready, try this code below to calculate objects speed.
Add fitting values to clauses!
Exercise 4. Lab as an alarm
Program the Laboratorio to alarm after the speed is over 1 m/s . You may be creative with this one, but here is some inspiration:
Add this code inside the loop of the previous code.
I’ll hope you will have inspiring coding moments!