# 10🔩 コードクラフトと拡張パック

## コードクラフトの使い方

**ペトイビトルのボードのカバーを外し、付属のUSBアダプターのチップを対応するピン穴に差し込みます。**

[**https://ide.tinkergen.com**](https://ide.tinkergen.com)

**上記のウェブサイトにアクセスし”Bittle”をクリックします。**<br>

![](https://lh5.googleusercontent.com/4ShoWiGIWmMhW6Z7969qFrq7Kaw9Qq_NsLqPVGXZ2HgLPI_brIKcyjgvUF9qEpEx9ZHnVVIpfCUzNhh3qP5p2TqDJWw3vBfdBc2X-UJgY5mfj36HdZf38w5OAiCTVq7IXLTDzPWt)

1. **“Device Assistant”をダウンロードする**

Codecraftを初めて利用される方は”Device Assistant”が必要になります。”Connect”を押すと下記のような画面が表示されるので”Download Device Assistant”をクリックします。

![helloworld-3-2.png](https://lh4.googleusercontent.com/4i2BzqKw6Lsu_85V7KPbZnjYc2xasY5DsipEb4bSI0g2c1ctmkVNCcfF0tvRayA0PT-LJ1owwIsDBmUtakhwRp0fU4aYl1Qew87Dd4M1GsiBo8cShabGjuIQ9BpP9Kt0-z1fFr7T)

インストールが完了後、フクロウのアイコンをクリックして起動します。起動させたら、再度”Connect”をクリックし自分で組んだコードをアップロードして完了です。

デバイスを繋ぐ際には「USBドングルを接続する」で選択したデバイスを選んでください。

![hw\_3\_4.png](https://lh4.googleusercontent.com/bWvPVUQS01Hhz552uVhujsOzF52cCBbNJqp6_KrWGxacbzp_buvC-Yc6lkN96Ab2qYgbcf8_WFtQ24iJX9OGjUfFnZq3HBXWdZtWHUHy-wtqpB7NvK82czJipDQGnlRj-q7n6wl7)

GitHubのコードとCodeCraftのコードにはバージョンが異なるため動作をうまく行えません。CodeCraftで行う場合は一度コードクラフトのスキルをアップデートする必要があります。

![](https://lh6.googleusercontent.com/BJn24ehSc8AWha8IH9vj8iStH-jivC37INV6f1Y1sLhKXsViRypgU-D6X3-NitNrc-v6Vy8alOteUD2Ivh2dxEWF3kq5EWkvr4GdpEBizW5Ld3BjwTvFN9dYP_r1VZHkS096K4Ah)

\
\
\ <br>

**・Touch Sensorを使う場合**

**下記の写真のようにセンサーをDigitalソケットに接続する。**

![](https://lh4.googleusercontent.com/OkrPsGfq8hieTCRLbTxrEqJz0hMCJWozbIJ4RrZ6Vq2b3QdIzROLSzMsfgDAvq4anZWfcL0HROs9E4CKXQMWd5-nvudMljP7N81rknVp_5Q_N9dqqgW5jsGREhhSb2ZVxJIq06Qc)

**Digitalソケットに接続**<br>

**コード例**

![](https://lh5.googleusercontent.com/QkIiBvXaCiv3WGbSKAEo8Mb-fkcFsYfPPYqQlN0TuUS4-HXd3qh5_FyxcJLT39ZANQdppPejY_KCX_s9plTw95Es30P4KmBCFTG_j2MKq-6LeKcWfRukhjzE496OWvRAm7IuVdji)

**Sound Sensorを使う場合**

Analogソケットに接続

![](https://lh5.googleusercontent.com/Ay99oMHFTvd9Kef6OxNTKZr1FcfCfwyn6haOcjIQn38TdRE4R6iEmi-rgqLaQdoYdW74WoY-1llG9-5XANETw7RmgqZmLNrIXKdTn6JsDPtiUhWnVjQ1xUHZ6QgorjVap6nI96yu)

**コード組合せ例**<br>

![2-2.png](https://lh5.googleusercontent.com/RQOUjo3KNBbyfLvWVyGK3upsj46P7fPbZW6wLcAFCLTli-hU7H7S_4wEgOLyHGgEEU34In8I-bGEGVCwUwjz5bf-uwOLNRgL0N1oMXnhqBes6ovVx6MImY1ekoiHyOq1dXnTBX_w)

**・Digital PIR Sensorを使う場合**

**Digitalソケットに接続**

![](https://lh4.googleusercontent.com/OkrPsGfq8hieTCRLbTxrEqJz0hMCJWozbIJ4RrZ6Vq2b3QdIzROLSzMsfgDAvq4anZWfcL0HROs9E4CKXQMWd5-nvudMljP7N81rknVp_5Q_N9dqqgW5jsGREhhSb2ZVxJIq06Qc)

**コード組合せ例**

![](https://lh6.googleusercontent.com/t94HF_4OVkTWp2zAIEc-lEUkZezFqWZq9HSm9AmoF4rJ2iiV_Aik9eq7i4Rx9MqzzAzvYoCJiQ3xXLBUZ4CS6iYQbYMI6Q9Oh3DfjX3CzGx5Fz4ssRDuHdbQK4eeiQthw_UVaOmw)

**・Intelligent Camera　（Arduino IDEを用いた場合）**\ <br>

下記のURL先の動画を参考にしてください

<https://www.youtube.com/watch?v=CxGI-MzCGWM>

I2Cソケットに接続

![](https://lh4.googleusercontent.com/pKAbAOZsMxyEYW2k6z31av6Joic7TZa8AEBg3eTeL4A3XjYcfbIyJ4_bbnxnpjh4d_q24XJ_Z5sWcwesjas7ToarnoMpfX-fvQheiSD9NAXgoUTjvQmI0_0WGNjmvMMHqyEnW0-t)

カメラにある左から２番目を上にあげる<br>

<https://github.com/petoicamp/balltracking>

からZip Fileをダウンロード<br>

Zip Fileを展開して”BallTracking-main”を”BallTracking”に変更<br>

<https://github.com/mu-opensource/MuVisionSensor3>

Zip Fileをダウンロード<br>

Sketch>Include Library>add zip fileからダウンロードしたファイルを選択<br>

WriteInstinctをアップロードしてシリアルモニターを開きYを三回

終了後

Ball Trackingをアップロード

（緑色の球体を追跡します）テニスボールなど<br>

The head of Bittle is designed to be a clip to hold extensible modules. We compiled a sensor pack with some popular modules, but its contents may change in the future. You can also wire other add-ons thanks to the rich contents of the Arduino and Raspberry Pi community.&#x20;

You can find the demo codes of these modules in our GitHub repository. They should be in the [ModuleTests](https://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests) folder if you download the whole OpenCat repository.

![](/files/-MTkh0ikD4iSFKbcvnhD)

The loudness and light level modules can generate [analog readings](https://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests/test_Loudness_Light) for the corresponding signals and should be connected to the analog Grove socket.&#x20;

&#x20;<img src="/files/-MTkekrdmpctYn5M4Csl" alt="" data-size="original">[Grove - Sound Sensor/ Noise Detector](https://www.seeedstudio.com/Grove-Loudness-Sensor.html)

<img src="/files/-MTkfj1_auKstc9phHen" alt="" data-size="original">[Grove - Light Sensor v1.2 - LS06-S phototransistor](https://www.seeedstudio.com/Grove-Light-Sensor-v1-2-LS06-S-phototransistor.html)

The touch, reflection, PIR sensors can generate digital 1 or 0 as a switch signal. So they should be connected to the digital Grove socket. In the [demo code](https://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests/test_Touch_Reflection_PIR), we use the fourth socket with D6 and D7.

&#x20;<img src="/files/-MTkfj1aKcwqe4n7chcR" alt="" data-size="original">[Grove - Touch Sensor](https://www.seeedstudio.com/Grove-Touch-Sensor.html)

<img src="/files/-MTkeksMqH4y4phrhoWY" alt="" data-size="original">[Grove - Infrared Reflective Sensor v1.2](https://www.seeedstudio.com/Grove-Infrared-Reflective-Sensor-v1-2.html)

<img src="/files/-MTkfj1ZGXfBFaMbin-6" alt="" data-size="original">[Grove - mini PIR motion sensor](https://www.seeedstudio.com/Grove-mini-PIR-motion-sensor-p-2930.html)

The [intelligent camera](https://github.com/PetoiCamp/BallTracking), [gesture](https://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests/testGesture), and [OLED](https://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests/testOLED) module should be connected to the I2C Grove socket.&#x20;

<img src="/files/-MTkfj1ctrfzb02nbn4J" alt="" data-size="original">[Grove - Gesture Sensor for Arduino (PAJ7620U2)](https://www.seeedstudio.com/Grove-Gesture-PAJ7620U2.html)

<img src="/files/-MTkfj1bXWQ2QGWhNqql" alt="" data-size="original">[Grove - OLED Display 0.96" (SSD1315)](https://www.seeedstudio.com/Grove-OLED-Display-0-96-SSD1315-p-4294.html)

<img src="/files/-MTkhSA4WxsWqhuvfMHC" alt="" data-size="original"> [MU Vision Sensor 3](http://store.morpx.com/page.php?a=sensor-support)

* [documentation](https://morpx-docs.readthedocs.io/en/latest/MUVS3/introduction.html#)
* [advanced user manual](https://drive.google.com/file/d/17ompJD5xtAi-hQEoZwoFsK_VIz4LaZ6I/view?usp=sharing)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bittle.petoi.com/ri-yu/extensible-modules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
