> For the complete documentation index, see [llms.txt](https://docs.aic-eec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aic-eec.com/general/development-on-crowpi/python-library-for-crow-pi.md).

# 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)
```
