> For the complete documentation index, see [llms.txt](https://sharinghub.kittenbot.hk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sharinghub.kittenbot.hk/mcu/meowbit/coding/meowbit_accel.md).

# Meowbit的陀螺儀

Meowbit上搭載了陀螺儀，Meowbit上有1個3軸的陀螺儀，可以測量X,Y,Z軸的轉動角度和加速度，甚至能偵測搖晃跌落等的狀態。

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel6.png)

### MakeCode Arcade編程教學

![](https://kittenbothk.readthedocs.io/en/latest/_images/acbanner2.png)

#### 載入控制器插件

#### [詳細方法](/programmingplatforms/makecode/kittenbotandmakecode.md)

![](https://kittenbothk.readthedocs.io/en/latest/_images/sd5.png)

![](https://kittenbothk.readthedocs.io/en/latest/_images/light12.png)

#### 控制器積木塊

![](https://kittenbothk.readthedocs.io/en/latest/_images/light22.png)

#### 陀螺儀編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel1.png)

```
轉動角度數值範圍由0-1023
```

小鴨子會跟隨我們傾斜Meowbit的幅度移動。

[參考程式](https://makecode.com/_5UrbHAFAFD2K)

#### 動作檢測編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel2.png)

我們拿著Meowbit做不同的動作會有相應的聲效。

[參考程式](https://makecode.com/_Pc0AufXvC6DD)

### Kittenblock編程教學

![](https://kittenbothk.readthedocs.io/en/latest/_images/kbbanner11.png)

#### 陀螺儀積木塊

![](https://kittenbothk.readthedocs.io/en/latest/_images/kb18.png)

#### 加速度編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel3.png)

小貓會一直說出現時的加速度數值。

#### 轉向加速度編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel4.png)

小貓會一直說出現時的轉向加速度數值。

#### 傾斜角度編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel5.png)

小貓會一直說出現時的傾斜角度。

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel7.png) ![](https://kittenbothk.readthedocs.io/en/latest/_images/accel8.png)

#### 動作檢測編程

```
動作檢測這裡有2種積木，事件觸發和返回數值。2種積木的功能基本上一樣，大家可以因編程需要而選擇。
```

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel9.png)

我們拿著Meowbit做不同的動作，小貓會說出相應的說話。

![](https://kittenbothk.readthedocs.io/en/latest/_images/accel10.png)

我們拿著Meowbit做不同的動作會有相應的聲效。
