Cách cài đặt các thư viện phần cứng Arduino Library: Difference between revisions

From MakerLab Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
Thư viện [https://www.arduino.cc/en/Reference/Libraries Arduino Library] là những bộ tập lệnh được cộng đồng những người sử dụng phần mềm Arduino xây dựng chuyên biệt cho các phần cứng kết nối với Arduino giúp bạn có thể dễ dàng lập trình với Arduino bằng cách gọi các hàm trong thư viện Library của phần cứng tương ứng, thư viện Arduino Library được coi là nhân tố quan trọng giúp phần mềm Arduino phổ biến như hiện nay với hàng ngàn bộ thư viện cho vô số phần cứng khác nhau giúp tiết kiệm thời gian viết và xây dựng chương trình.
Thư viện [https://www.arduino.cc/en/Reference/Libraries Arduino Library] là những bộ tập lệnh được cộng đồng những người sử dụng phần mềm Arduino xây dựng chuyên biệt cho các phần cứng kết nối với Arduino giúp bạn có thể dễ dàng lập trình với Arduino bằng cách gọi các hàm trong thư viện Library của phần cứng tương ứng, thư viện Arduino Library được coi là nhân tố quan trọng giúp phần mềm Arduino phổ biến như hiện nay với hàng ngàn bộ thư viện cho vô số phần cứng khác nhau giúp tiết kiệm thời gian viết và xây dựng chương trình.


== How to Install a Library ? ==
== Cách cài đặt Thư viện Arduino Library ==
Here we will introduce the most simple way for you to add libraries <br>
Để cài đặt Thư viện Arduino Library cho phần cứng tương ứng, đầu tiên cần tải bộ thư viện về máy tính, thường bộ thư viện sẽ dưới dạng file .zip, sau khi tải về bạn cần xả nén và sẽ có thư mục dạng như hình:
After download well the Arduino IDE, you can right-click the icon of Arduino IDE.<br>
Find the option "Open file location" shown as below.
<br>[[Image:Libraries 1.png|600px|frameless|link=Special:FilePath/Libraries_1.png]]<br>
<br>
Then, click to open the libraries folder, you can directly add the libraries inside the folder.
<br>[[Image:Libraries 3.png|600px|frameless|link=Special:FilePath/Libraries_3.png]]<br>
It is very easy for you to add the libraries in this way!
 


Sau khi xả nén và có thư mục, bạn nhấn chuột phải vào Icon của phần mềm Arduino và chọn "Open file location" để tìm về thư mục cài đặt chính của chương trình Arduino:<br>[[Image:Libraries 1.png|600px|frameless|link=Special:FilePath/Libraries_1.png]]<br>Trong thư mục cài đặt chương trình Arduino bạn sẽ thấy 1 thư mục tên "libraries", bạn chép thư mục của Library cần thêm vào Arduino vào đây:<br>[[Image:Libraries 3.png|600px|frameless|link=Special:FilePath/Libraries_3.png]]<br>Sau khi đã hoàn tất, bạn vào Arduino để kiểm tra Library đã được thêm vào chưa bằng cách vào File->Example sẽ thấy Code mẫu của bộ thư viện Library tương ứng.
'''Or you can refer to another method to add libraries.''' <br>
'''Or you can refer to another method to add libraries.''' <br>
Inside the folder will be a .cpp file, a .h file and often a keywords.txt file, examples folder, and other files required by the library.<br>
Inside the folder will be a .cpp file, a .h file and often a keywords.txt file, examples folder, and other files required by the library.<br>
Take Arduino1.0.5 as an example, you can install a library in Arduino IDE. And do not unzip the downloaded library, leave it as is.
Take Arduino1.0.5 as an example, you can install a library in Arduino IDE. And do not unzip the downloaded library, leave it as is.
*In the Arduino IDE, click Skietch->Import Library.  Select “Add Library...” at the top of the drop down list.  <br>[[Image:Add Library.png|600px|frameless|link=Special:FilePath/Add_Library.png]]<br>
*In the Arduino IDE, click Skietch->Import Library.  Select “Add Library...” at the top of the drop down list.  <br>[[Image:Add Library.png|600px|frameless|link=Special:FilePath/Add_Library.png]]<br>



Revision as of 09:48, 26 May 2021

Thư viện Arduino Library là gì?

Thư viện Arduino Library là những bộ tập lệnh được cộng đồng những người sử dụng phần mềm Arduino xây dựng chuyên biệt cho các phần cứng kết nối với Arduino giúp bạn có thể dễ dàng lập trình với Arduino bằng cách gọi các hàm trong thư viện Library của phần cứng tương ứng, thư viện Arduino Library được coi là nhân tố quan trọng giúp phần mềm Arduino phổ biến như hiện nay với hàng ngàn bộ thư viện cho vô số phần cứng khác nhau giúp tiết kiệm thời gian viết và xây dựng chương trình.

Cách cài đặt Thư viện Arduino Library

Để cài đặt Thư viện Arduino Library cho phần cứng tương ứng, đầu tiên cần tải bộ thư viện về máy tính, thường bộ thư viện sẽ dưới dạng file .zip, sau khi tải về bạn cần xả nén và sẽ có thư mục dạng như hình:

Sau khi xả nén và có thư mục, bạn nhấn chuột phải vào Icon của phần mềm Arduino và chọn "Open file location" để tìm về thư mục cài đặt chính của chương trình Arduino:
Libraries 1.png
Trong thư mục cài đặt chương trình Arduino bạn sẽ thấy 1 thư mục tên "libraries", bạn chép thư mục của Library cần thêm vào Arduino vào đây:
File:Libraries 3.png
Sau khi đã hoàn tất, bạn vào Arduino để kiểm tra Library đã được thêm vào chưa bằng cách vào File->Example sẽ thấy Code mẫu của bộ thư viện Library tương ứng. Or you can refer to another method to add libraries.
Inside the folder will be a .cpp file, a .h file and often a keywords.txt file, examples folder, and other files required by the library.
Take Arduino1.0.5 as an example, you can install a library in Arduino IDE. And do not unzip the downloaded library, leave it as is.

  • In the Arduino IDE, click Skietch->Import Library. Select “Add Library...” at the top of the drop down list.
    File:Add Library.png


  • You will be prompted to select the library you would like to add. Find the .zip file's location and open it. Here I select a library named smallePaper.
    File:SmallePaper.png


  • Return to the Sketch > Import Library menu. You should now see the library at the bottom of the drop-down menu. It is ready to be used in your sketch.
    File:Your sketch.png


  • Now the zip file has been installed in your Arduino sketches directory. You can see the location of the library: File->Preferences->Sketchbook location, and can change the location. Generally, we will change it as ….Arduino – 1.0.5\libraries as shown below.
    File:Below.png


More reference please click the link here:
https://www.arduino.cc/en/Guide/Libraries