> 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/getting-start/lvgl-light-and-versatile-embedded-graphics-library/lvgl-simulator.md).

# Get started with LVGL simulator

LVGL simulator on linux

* สำหรับ RaspberryPI สามารถเปิดขึ้นมาด้วยการไปที่ ไอคอน Raspberry (ซ้ายบน) → Programming → code OSS

![](https://paper-attachments.dropbox.com/s_0079DB98C1AC48084A041CE98E67B4E390E3C3D69ABBE751B587DF003A9A5FEA_1614139433749_image.png)

* สำหรับ Ubuntu เรียกเปิดโดยการใช้คำสั่ง&#x20;

```bash
$ git clone --recursive https://github.com/lvgl/lv_sim_vscode_sdl
$ sudo apt-get update && sudo apt-get install -y build-essential libsdl2-dev
$ cd lv_sim_vscode_sdl && code . 
```

{% hint style="danger" %}
บน Ubuntu จำเป็นต้องติดตั้ง VScode ก่อนใช้งาน
{% endhint %}

เมื่อเปิดขึ้นมาจะพบกับหน้าต่าง IDE ดังรูป

![](https://paper-attachments.dropbox.com/s_0079DB98C1AC48084A041CE98E67B4E390E3C3D69ABBE751B587DF003A9A5FEA_1614139477149_image.png)

* สำหรับ WSL2 ให้เปิด [XLuanch](https://app.gitbook.com/@aic-ecc/s/docs/~/drafts/-MfRTY5RvmScV5JYGBbP/smart-living/getting-start) และ[ terminater](https://app.gitbook.com/@aic-ecc/s/docs/~/drafts/-MfRTY5RvmScV5JYGBbP/smart-living/getting-start) ขึ้นมาแล้วทำการเชื่อมต่อ vscode เข้ากับ WSL  เมื่อเชื่อมต่อเรียบร้อยดำเนินต่อตามวิธีด้านล่างต่อไปได้เลย

ไปยัง Project explorer → main/src → main.c (การเขียนโปรแกรมทั้งหมดต้องทำภายใต้ file main)

![](https://1856353139-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MClo3nC-1US0rbK8Qau%2F-MfRYAFoDXmfPu6lpCvl%2F-MfRa4i-a3dKgr6-zq3o%2Fselect_di.png?alt=media\&token=f40faa63-6d20-4ce1-8c45-e5e5cf2d9393)

เมื่ออยู่ในหน้าของ main.c แล้วให้กด F5 เพื่อทำการ make file ขึ้นมาซึ่งไฟล์ที่ make สำเร็จแล้วจะภายใต้ไดเรคทอรี่ build/bin โดยไฟล์จะชื่อว่า demo เมื่อทำการ make file สำเร็จแล้วอาจมี error เกิดขึ้นเนื่องจากไม่สามารถเปิดไฟล์ debug ได้ซึ่งไม่ส่งผลอะไรกับโปรแกรม สามารถเรียกไฟล์ให้ทำงานได้ปกติ

![ผลที่ได้หลังจากการ build](https://1856353139-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MClo3nC-1US0rbK8Qau%2F-MfRY1a41b7fJdZYpN13%2F-MfRY6U81Lf042YvajJn%2Fimage.png?alt=media\&token=f7cf0915-c3dd-4c18-8a7a-0a521ba3bfc9)
