> For the complete documentation index, see [llms.txt](https://docs.petoi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.petoi.com/thai/api/undefined.md).

# ซีเรียลโปรโตคอล

เราได้กำหนดชุดของซีเรียลโปรโตคอลสำหรับหุ่นยนต์:

![](https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2FSS2u4nE0lAQJuBtfx0q0%2FserialProtocol.png?alt=media\&token=ce61d901-ea80-4c60-a500-b7e5621bd386)

โทเคนทั้งหมดเริ่มต้นด้วยอักขระเดียวที่เข้ารหัสด้วย ASCII เพื่อระบุรูปแบบการวิเคราะห์ของตัวอักษร โดยโทเคนเหล่านี้จะมีความสำคัญต่อตัวพิมพ์เล็กและใหญ่ และโดยปกติจะเป็นตัวพิมพ์เล็ก

{% hint style="info" %}
บางคำสั่ง เช่น คำสั่ง **c** และ **m** สามารถรวมกันได้ \
ตัวอย่างเช่น: คำสั่งต่อเนื่อง "m8 40", "m8 -35", "m 0 50" สามารถเขียนรวมกันเป็น "m8 40 8 -35 0 50" คุณสามารถรวมคำสั่งได้สูงสุด 4 คำสั่งที่เป็นประเภทเดียวกัน โดยเพื่อความถูกต้อง ความยาวของสตริงควรน้อยกว่า 30 ตัวอักษร คุณสามารถเปลี่ยนค่าขีดจำกัดในโค้ด แต่อาจมีข้อจำกัดเชิงระบบสำหรับบัฟเฟอร์ซีเรียล
{% endhint %}

สามารถทดลองคำสั่งของซีเรียลได้ที่ [the serial monitor](https://docs.petoi.com/arduino-ide/serial-monitor):

* “**k**sit”
* “**m**0 30”
* “**m**0 -30”
* “**k**balance”
* “**k**wkF”
* “**k**trL”
* “**d**”

{% hint style="warning" %}
เครื่องหมายอัญประกาศเพียงแค่บ่งบอกว่าพวกเขาเป็นสตริงตัวอักษร เมื่อคุณพิมพ์ในมอนิเตอร์ซีเรียล ไม่ต้องพิมพ์เครื่องหมายอัญประกาศ

เครื่องหมายอัญประกาศ = " "
{% endhint %}

คุณสามารถอ้างอิงถึงคำนิยามแมโครใน OpenCat.h เพื่อใช้ชุดโทเคนที่มีการอัปเดตล่าสุด

<figure><img src="https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2FlaKGzgBCdMrFa2DnZbMQ%2Ftokens.png?alt=media&amp;token=ea49b494-7623-43c9-aba4-2d7cadca6993" alt=""><figcaption></figcaption></figure>

บางคำสั่งที่มีให้ใช้สำหรับทักษะหุ่นยนต์เพิ่มเติม:

![](https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2F1ie6rUWXfxBX0UlbSAZU%2FserialTokenExamples.png?alt=media\&token=9ef81a6e-99d0-4cbf-9769-002df0923f5d)

ชุดความสามารถที่สมบูรณ์และใช้งานอยู่ถูกกำหนดไว้ใน [InstinctBittle.h](https://github.com/PetoiCamp/OpenCat/blob/main/src/InstinctBittle.h) หรือ [InstinctNybble.h](https://github.com/PetoiCamp/OpenCat/blob/main/src/InstinctNybble.h):\
ตัวอย่างเช่น :

{% code overflow="wrap" %}

```cpp
const char* skillNameWithType[]={"bdFI","bkI","bkLI","crFI","crLI","hlwI","mhFI","mhLI","pcFI","phFI","phLI","trFI","trLI","vtFI","vtLI","wkFI","wkLI","balanceI","buttUpI","calibI","droppedI","liftedI","restI","sitI","strI","zeroN","bfI","ckI","climbCeilI","fdI","ffI","hiI","jyI","pdI","peeI","puI","pu1I","rcI","rlLI","rtI","stpI","tsI",};
```

{% endcode %}

ชื่อทักษะทั้งหมดในรายการสามารถเรียกใช้งานโดยการเพิ่ม 'k' ไปด้านหน้าและลบคำต่อท้าย ตัวอย่างเช่น มี "sitI" อยู่ในรายการ คุณสามารถส่ง "ksit" เพื่อเรียกท่านั่ง หากทักษะมีอักขระ "F" หรือ "L" เป็นอักขระที่สองจากท้าย นั่นเป็นการเดิน หมายความว่าเดินไปข้างหน้าหรือไปทางซ้าย เดินไปทางขวาเป็นการสะท้อนของการเดินไปทางซ้าย ดังนั้นคุณสามารถส่ง "kwkF", "kwkL", "kwkR" เพื่อให้หุ่นยนต์เดิน ในทำนองเดียวกัน ยังมีการเดินแบบอื่น ๆ เช่น รถโรงเรียน ("tr"), คลาน ("cr"), และการเดินขาละขา ("vt")


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.petoi.com/thai/api/undefined.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
