Case 3 - Detect postures

Part 1  Objective

After you compile the program, the stage displays the angles you rotate the gyro sensor around the x-axis, y-axis, and z-axis in real time.

1.gif

Part 2  Preparation

  • MegaPi x 1
  • MegaPi RJ25 adapter x 1
  • RJ25 cable x 1
  • Gyro sensor x 1
  • USB cable (Type-B) x 1
  • Computer with network access x 1

Install the MegaPi RJ25 adapter on MegaPi, connect the gyro sensor to MegaPi by using the RJ25 cable, connect MegaPi to the computer by using the USB cable, open mBlock 5 (PC client or web version), click +add, select Ultimate 2.0 from the Device Library, click Connect, and select the Live mode.

2.gif

3.gif

Update the firmware of Ultimate 2.0.

4.gif

Part 3  Programming

In Live mode, you can create different variables to get the angles of the gyro sensor around the x-axis, y-axis, and z-axis. When you select the check boxes on the left of the x-axis angle, y-axis angle, and z-axis angle blocks and run the program, the stage displays the angles of the gyro sensor around the x-axis, y-axis, and z-axis.

5.gif

Part 4  Practice

Rotate the gyro sensor, and see if you can find the directions of x, y, and z axes.

Was this article helpful?
0 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.