Gyro sensor - Switch Pro Preview

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

Subscribe

  • #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.content picture

  • 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. content picture

 

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.

content picture

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

Image for Level D2. "Seafaring". Robotics with LEGO
  • 24
  • 2:49
  • 107
Image for Lesson 5 - Following a direction
  • 5
  • 3
  • 8
  • 3d_rotation 0
Image for Robotics with LEGO - Level 4.0 - Kinesthetic and Memory Game (in development)
  • 59
  • 2:58
  • 200
Image for Robotics with LEGO - Level 2.5 - Maritime Journey
  • 42
  • 3:52
  • 133
Image for Lesson 5 - Personal Yacht
  • 7
  • 3
  • 10
  • 3d_rotation 0