Snap Lesson 13: Gyro Turn
In this lesson we will learn about how to control the CoDrone’s turning better
For making the CoDrone turn we will check the direction that it is facing and turn towards 90 degrees. By using this if statement we can make the gyro turns more efficient since if we were only a few degrees off, but our turn direction was the opposite way, the CoDrone would have to almost make a full circle to face the right direction. After the repeat until loop ends we will set the yaw to 0 so that the CoDrone will stop spinning.
Now adding in a takeoff and landing commands we have a full code. No matter which way the CoDrone faces it will turn towards 90 degrees.
Activity: Gyro Turning
The challenge is to have the CoDrone takeoff and turn towards the 4 main directions (0, 90, 180, 270)
Challenge Rules:
- The CoDrone will takeoff, turn towards the next direction
- Once it faces the proper direction have it wait 3 seconds
- Then turn to the next direction until all 4 directions have been faced