# Python library for Crow Pi

## **Python library for Crow Pi**

### **Preparation**

&#x20;    การเตรียมความพร้อมสำหรับใช้ library python ในการสั่งงาน sensor บนบอร์ด CrowPi &#x20;

**คำสั่ง:** update และ upgrade package ของ Raspberry Pi OS

```typescript
sudo apt-get update && sudo apt-get upgrade
```

**คำสั่ง:** ติดตั้ง package สำหรับ run python3&#x20;

<pre class="language-typescript"><code class="lang-typescript"><strong>sudo apt-get install build-essential python3-dev python3-smbus python3-pip python3-pil liblircclient-dev
</strong></code></pre>

### **Drivers installation**

&#x20;    การใช้ sensor หรืออุปกรณ์บน CrowPi จำเป็นต้องลง driver สำหรับใช้งาน ซึ่ง CrowPi ได้จัดเตรียม Driver ที่จำเป็นและการ setup ไว้ในแล้ว ซึ่งสามารถทำตามขั้นตอนดังต่อไปนี้<br>

**คำสั่ง:** คัดลอกไฟล์จาก github

<pre class="language-typescript"><code class="lang-typescript">git clone https://github.com/Elecrow-RD/CrowPi.git
<strong>cd CrowPi/Drivers
</strong></code></pre>

**คำสั่ง:** install Driver Adafruit\_Python\_CharLCD:

<pre class="language-typescript"><code class="lang-typescript"><strong>cd Adafruit_Python_CharLCD
</strong>sudo python3 setup.py install
cd ..
</code></pre>

**คำสั่ง:** install Driver Adafruit\_Python\_LED\_Backpack:

<pre class="language-typescript"><code class="lang-typescript"><strong>cd Adafruit_Python_CharLCD
</strong>sudo python3 setup.py install
cd ..
</code></pre>

**คำสั่ง:**&#x69;nstall Driver Luma Matrix LED:

```typescript
cd luma.led_matrix
sudo python3 setup.py install
cd ..
```

### **Ex ทดลองรัน code python ใน ไดเรกทอรี่ 5 คำสั่งแล้วบันทึกผล**&#x20;

**คำสั่ง:** run python code สั่ง buzzer.py ทำงาน

```typescript
python3 buzzer.py


Date: May 2023
Author: Soontree Jaikhong (AIC-Researcher)
Author: Thanaluk Pranekunakol (AIC-Researcher)
```


---

# 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://docs.aic-eec.com/general/development-on-crowpi/python-library-for-crow-pi.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.
