We already know how to use the gyro sensor with wait block, now its time to learn how to use it with Switch.

To access the full video please subscribe to FLLCasts.com
- #1278
- 08 May 2019
The Gyro sensor, like every other sensor, has its own setting in the Switch.
Unlike the wait block, where there are two options, here we have only a compare mode. If you place the mouse over it, you will see two sub-modes.
- Angle - the robot compares with a certain value, by default 90, the number of degrees the sensor has rotated. The block checks if the comparison is true and executes the relevant commands according to the result.
-
Rate - the robot compares with a certain value, by default 90, the rate of change in the rotations measured by the sensor - i.e. how many degrees per second the sensor rotates. The block checks if the comparison is true and executes the relevant commands according to the result.
The last setting we need to pay attention to is the port to which the sensor is connected. By default it's 2, but if we have to, we can change it to any port from 1 to 4.
Important part of the programming of the gyro sensor is that when we run a program or start port view, it starts measuring degrees from 0. Clockwise rotation is measured as positive and counterclockwise as negative degrees. Just like with the rotation sensor that follows the same logic.
Unlike the degrees, the rate is always 0, until it turns. When it stops turning, it goes to 0 again.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Level D2. "Seafaring". Robotics with LEGO
The eighth level of the Robotics with LEGO curriculum for students in third or fourth grade.
In this level, students learn to use the fourth sensor in the robotics set - the gyro sensor. The robots are modeled after boats, yachts, and ships. With the help of the gyro sensor, students can set a course for their robots to a given angle and can detect deviations from the course. In open seas, there may be sea-monsters and the robots are being programmed to detect a sudden change in acceleration with the help of the said sensor.
- 24
- 2:49
- 107

Lesson 5 - Following a direction
Returning feedback to students is important. We try to return feedback constantly in the classes. You should also try to return feedback in a structured way - in a form of a digit. Today you will have to grade your students following this article.
- 5
- 3
- 8
- 3d_rotation 0

Robotics with LEGO - Level 4.0 - Kinesthetic and Memory Game (in development)
The seventh level of the Robotics with LEGO curriculum for students in sixth or seventh grade.
In this level, student develop a memory training game. The player must remember series of actions like press a button, shake a pole, pull a lever, show one of many colors. In order to program the game, students use many variables and modify their states. Students create their own custom sounds and images, in order to reflect their own personality in the game. In the end of the level, the game stores top scores even after a full shut down with the help of text files.
- 59
- 2:58
- 200

Remind yourself how to work with the gyro sensor
You've seen the gyro sensor. It has two arrow. How does it work? What does it do?
- 6
- 0
- 0
- 3d_rotation 0

Robotics with LEGO - Level 2.5 - Maritime Journey
The fourth level of the Robotics with LEGO curriculum for students from fifth to twelfth grades.
In this level students focus on the rotational sensor that is part of every motor in the robotics set. Students also learn to use the fourth sensor in the robotics set - the gyro sensor.
First few robot constructions imitate sea-animals and their behavior. Students create programs that check whether the robot's claws or pecks have successfully caught an object. That sensor in the motors allows the robots to go back in their lairs even after the use of unlimited movement. The rest of the robots are modeled after boats, yachts, and ships. With the help of the gyro sensor, students can set a course for their robots to a given angle and can detect deviations from the course. In open seas, there may be sea-monsters and the robots are being programmed to detect a sudden change in acceleration with the help of the said sensor.
- 42
- 3:52
- 133

Lesson 5 - Personal Yacht
Returning feedback to students is important. We try to return feedback constantly in the classes. You should also try to return feedback in a structured way - in a form of a digit. Today you will have to grade your students following this article.
- 7
- 3
- 10
- 3d_rotation 0