write gyro code