# KOI 2 in MakeCode Quick Start Guide

## <mark style="color:orange;">**Wiring**</mark>

### **1. Use with Robotbit EDU**

Use the cable included to connect KOI to Robotbit.

Connect KOI 2 to the serial port of the Robotbit EDU as shown in the illustration.

As Robotbit EDU uses P2 and P12 for its serial port, you will need to select the appropiate pins in the MakeCode program.

{% hint style="info" %}
If you wish to power the KOI using USB power, please remove the black(GND) and red(5V) wires.
{% endhint %}

<figure><img src="/files/9bpX9DUJSlCBbIoeGl7P" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
KOI 2 RX Port(Yellow) Connects to Robotbit TX Port(P2)

KOI 2 TX Port(Blue) Connects to Robotbit RX Port(P12)
{% endhint %}

<figure><img src="/files/vk2t5v7ZwIIXsHrRnFxW" alt=""><figcaption></figcaption></figure>

### **2. Use with Robotbit 2.2**

Use the cable included to connect KOI to Robotbit.

Refers to the following illustration for correct wiring.

&#x20;           Black - GND

&#x20;           Red - 5V

&#x20;           Yellow - P2 (TX)

&#x20;           Blue - P12 (RX)

```
The (Blue)TX wire must be connected to an analog pin(Pin0-Pin2).
Remember to remove the buzzer jumper when Pin0 is used.
```

<figure><img src="https://kittenbothk.readthedocs.io/en/latest/_images/robotbit_connection1.png" alt=""><figcaption></figcaption></figure>

**Do not connect Red to Ground and Black to 5V!!!**

Ensure the connection is correct and switch the power on.

<figure><img src="https://kittenbothk.readthedocs.io/en/latest/_images/robotbit_connection2.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://kittenbothk.readthedocs.io/en/latest/_images/robotbit_connection3-1.png" alt=""><figcaption></figcaption></figure>

### **3. Use with Armourbit**

It is easier to connect to an Armourbit because they both use PH2.0 connectors.

When using KOI with an Armourbit, KOI needs an extra 5V power source.

Using the USB port on the battery box, 5V power can be supplied to KOI. (See figure below)

<figure><img src="https://kittenbothk.readthedocs.io/en/latest/_images/armourbit_connection1-1.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://kittenbothk.readthedocs.io/en/latest/_images/armourbit_connection2-3.png" alt=""><figcaption></figcaption></figure>

Use the corresponding programming block and select the correct port.(Default Port 1)

<figure><img src="/files/PRySz3yLEmEQvnYKs7ci" alt=""><figcaption></figcaption></figure>

## <mark style="color:orange;">MakeCode Extension Quick Guide</mark>

### Import KOI 2 Extension for MakeCode

Extension Address:

## [**https://github.com/KittenBot/pxt-koi2**](https://github.com/KittenBot/pxt-koi2)

Open the extension tab in MakeCode.

<figure><img src="https://kittenbothk.readthedocs.io/en/latest/_images/16-1.png" alt=""><figcaption></figcaption></figure>

Search for KOI2 in the search bar, select KOI 2.(KOI 2 has been approved by Microsoft)

<figure><img src="/files/Sw7BOOSrTSX5zHmVemsd" alt=""><figcaption></figcaption></figure>

The extension will be imported into your project.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FSkO076z0lrID98zSivpa%2Fimage.png?alt=media&#x26;token=41cbc34a-9933-49f6-a4ce-62c0af2e6822" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">1. Initialization</mark>&#x20;

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FjPCDYYmTZPo2Jnzf1RyN%2Fimage.png?alt=media&#x26;token=fb13d3f5-af5e-4b57-9db6-6492ac512aaa" alt=""><figcaption></figcaption></figure>

Initializes the communication between KOI 2 and Micro:bit, must be included at the top of the program.

#### &#x20;<mark style="background-color:yellow;">2. Basic Operation</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2Fg8gveE0DC4idrYoORQEx%2Fimage.png?alt=media&#x26;token=97b18306-46f0-43d8-8aba-690e1ac10ca3" alt=""><figcaption></figcaption></figure>

Basic Operations for KOI 2 such as taking pictures and showing text.

#### &#x20;<mark style="background-color:yellow;">3. Function Selection</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FekJiYjyUbxlSyxEZst79%2Fimage.png?alt=media&#x26;token=3ac5b3d8-231d-4815-a6f7-b0d4e7b5895c" alt=""><figcaption></figcaption></figure>

Switching function is required to run the corresponding AI function.

#### &#x20;<mark style="background-color:yellow;">4. Face Tracking</mark>&#x20;

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2F4NqJm2V0GxQz4VCrHMom%2Fimage.png?alt=media&#x26;token=ea871158-217c-4b7a-aa85-378910511885" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">5. Face Mask</mark>&#x20;

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FM8Wgv7SSdEBIsp8KvNYk%2Fimage.png?alt=media&#x26;token=14a13c24-be54-4cd2-819a-9caac5971deb" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">6. Color Blob Tracking</mark>&#x20;

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FqLOoRdzxjrDItARCGQoe%2Fimage.png?alt=media&#x26;token=9214c3d0-86fe-4a2f-adc3-8acde2705a1e" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">7. Line Follower</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FONDuKNPPQqvb0eUB6cmr%2Fimage.png?alt=media&#x26;token=35c455e1-e03d-4689-960e-ee8d64cfec35" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">8. Image Classifier</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FKJBCamCme1kOp87DZSyo%2Fimage.png?alt=media&#x26;token=86c63e73-8232-4693-9be0-9050a915bbc4" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">9. Built-in Tracking: Traffic Sign</mark>&#x20;

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2Fxwg4eGR6tbLqXPl1Uslk%2Fimage.png?alt=media&#x26;token=486a2258-d6e2-4ebb-8c2e-15a21bc17794" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">10. Built-in Tracking: Numbers</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FcSBWcbLHC7EmzXJtVODY%2Fimage.png?alt=media&#x26;token=c7c88a1a-7230-40fa-aa77-7f670d635ea2" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">11. Built-in Tracking: Common Items</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FcdrSY8oosgOkO5QZqcAJ%2Fimage.png?alt=media&#x26;token=a11b81a3-c3a4-4ea8-8213-57eed61585b0" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">12. Code Scanner</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2Flg1tHcVhYhBKet094EBH%2Fimage.png?alt=media&#x26;token=1ce40289-bc01-4e33-989c-ccd38bebe56a" alt=""><figcaption></figcaption></figure>

#### &#x20;<mark style="background-color:yellow;">13. WiFi IoT</mark>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsN6MlwBFbL3P67FzMMyL%2Fuploads%2FPTCn8iBkL2mRlll9o3sm%2Fimage.png?alt=media&#x26;token=d0f50193-99e4-4f16-8ea9-28322d35ccd6" alt=""><figcaption></figcaption></figure>


---

# 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://sharinghub-eng.kittenbot.hk/airelated/ai-camera-koi-2/makecode-programming/koi-2-in-makecode-quick-start-guide.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.
