Khác biệt giữa các bản “Module NOKIA N5110”

Từ ChipFC Wiki
Bước tới: chuyển hướng, tìm kiếm
(Một số cú pháp cơ bản)
(Một số cú pháp cơ bản)
 
(Không hiển thị 9 phiên bản của 2 người dùng ở giữa)
Dòng 38: Dòng 38:
  
 
== Sử dụng ==  
 
== Sử dụng ==  
 +
Sơ đồ kết nối
 +
 +
[[Tập tin:No002.png|400px]]
  
[[Tập tin:No002.png|400px|phải]]
 
Sơ đồ kết nối
 
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 
|+ Kết nối chân tới Arduino
 
|+ Kết nối chân tới Arduino
Dòng 67: Dòng 68:
 
Source code mẫu:
 
Source code mẫu:
  
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
#include <bmps.h>
 
#include <bmps.h>
 
#include <PCD8544_HOANGSA.h>
 
#include <PCD8544_HOANGSA.h>
Dòng 82: Dòng 82:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
== Một số cú pháp cơ bản ==
 
== Một số cú pháp cơ bản ==
 
* Cấu trúc khai báo thư viện
 
* Cấu trúc khai báo thư viện
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
#include "ST7565_homephone.h"//a
 
#include "ST7565_homephone.h"//a
 
ST7565 lcd(3,4,5,6);//b
 
ST7565 lcd(3,4,5,6);//b
+
 
 
 
void setup()  {   
 
void setup()  {   
 
   lcd.ON();//c
 
   lcd.ON();//c
Dòng 99: Dòng 96:
  
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Cài đặt giao diện
 
* Cài đặt giao diện
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
   void SET(byte contrast, bool negative, bool rotation, bool mirror, byte tyledientro);
 
   void SET(byte contrast, bool negative, bool rotation, bool mirror, byte tyledientro);
 
   Hàm này có thể được gọi nhiều lần với các thông số khác.
 
   Hàm này có thể được gọi nhiều lần với các thông số khác.
Dòng 113: Dòng 108:
 
   tyledientro - bằng R1/R2 - thiết lập điện áp hoạt động- 0 -> 6 (0x0 đến 0x6)
 
   tyledientro - bằng R1/R2 - thiết lập điện áp hoạt động- 0 -> 6 (0x0 đến 0x6)
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
* In ra màn hình
 
 
* Boolean color: chỉ chấp nhận 3 loại sau BLACK (1), WHITE(0), DELETE(0)
 
* Boolean color: chỉ chấp nhận 3 loại sau BLACK (1), WHITE(0), DELETE(0)
  
Dòng 123: Dòng 116:
  
 
* Vẽ 1 điểm có tọa độ x, y
 
* Vẽ 1 điểm có tọa độ x, y
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void DrawPixel(int x,int y, bool color);   
 
void DrawPixel(int x,int y, bool color);   
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Đọc dữ liệu bộ nhớ
 
* Đọc dữ liệu bộ nhớ
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
bool GetPixel( int x, int y);
 
bool GetPixel( int x, int y);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Vẽ đoạn thẳng
 
* Vẽ đoạn thẳng
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void DrawLine(int x0,int y0,int x1,int y1,  bool color);
 
void DrawLine(int x0,int y0,int x1,int y1,  bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Vẽ hình chữ nhật
 
* Vẽ hình chữ nhật
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Rect(int x,int y, int w, int h, bool color);
 
void Rect(int x,int y, int w, int h, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Tô màu hình chữ nhật
 
* Tô màu hình chữ nhật
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void FillRect(int x,int y, int w, int h, bool color);
 
void FillRect(int x,int y, int w, int h, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Hình chữ nhật kèm hiệu ứng bo góc
 
* Hình chữ nhật kèm hiệu ứng bo góc
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Corner( int x,int y, int w, int h,int r, bool color);
 
void Corner( int x,int y, int w, int h,int r, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Vẽ Corner tô màu
 
* Vẽ Corner tô màu
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void FillCorner( int x,int y,int w,int h, int r, bool color);
 
void FillCorner( int x,int y,int w,int h, int r, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
+
 
 
[[Tập tin:On0003.jpg|300px]]
 
[[Tập tin:On0003.jpg|300px]]
 
  
 
* Vẽ tam giác
 
* Vẽ tam giác
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Tri (int x1,int y1,int x2,int y2,int x3,int y3, bool color);
 
void Tri (int x1,int y1,int x2,int y2,int x3,int y3, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Vẽ tam giác tô màu
 
* Vẽ tam giác tô màu
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void FillTri(int x1,int y1,int x2,int y2 ,int x3,int y3, bool color);
 
void FillTri(int x1,int y1,int x2,int y2 ,int x3,int y3, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Vẽ đường tròn
 
* Vẽ đường tròn
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Circle(int x0,int y0,int r, bool color);
 
void Circle(int x0,int y0,int r, bool color);
 
+
</syntaxhighlight>
  
 
* Vẽ hình tròn tô màu
 
* Vẽ hình tròn tô màu
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void FillCircle(int x0,int y0, int r, bool color);
 
void FillCircle(int x0,int y0, int r, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Vẽ elip
 
* Vẽ elip
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Elip( int x, int  y,  int xRadius, int  yRadius, bool color);
 
void Elip( int x, int  y,  int xRadius, int  yRadius, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Vẽ hình elip tô màu
 
* Vẽ hình elip tô màu
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void FillElip(int x0, int y0  , int  xRadius,  int  yRadius, bool color);
 
void FillElip(int x0, int y0  , int  xRadius,  int  yRadius, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Viết 1 kí tự trong bảng ASCII
 
* Viết 1 kí tự trong bảng ASCII
 +
<syntaxhighlight lang="cpp">
 
void Asc_Char(int x1, int y1,unsigned char c, bool color);
 
void Asc_Char(int x1, int y1,unsigned char c, bool color);
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
</syntaxhighlight>
|<syntaxhighlight lang="cpp">
+
 
 +
<syntaxhighlight lang="cpp">
 
void loop(){
 
void loop(){
 
     //cách 1:
 
     //cách 1:
Dòng 240: Dòng 204:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
[[Tập tin:No004.jpg|400px]]
+
[[Tập tin:No004.jpg|600px]]
 
   
 
   
 
* Viết một chuỗi kí tự
 
* Viết một chuỗi kí tự
 +
<syntaxhighlight lang="cpp">
 
void Asc_String(int x1, int y1,unsigned char c[] , bool color);
 
void Asc_String(int x1, int y1,unsigned char c[] , bool color);
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
</syntaxhighlight>
|<syntaxhighlight lang="cpp">
+
 
 +
<syntaxhighlight lang="cpp">
 
void loop(){
 
void loop(){
 
     //cách 1:  
 
     //cách 1:  
Dòng 258: Dòng 223:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Viết 1 kí tự tiếng Việt
 
* Viết 1 kí tự tiếng Việt
 +
<syntaxhighlight lang="cpp">
 
void Uni_Char(int x1, int y1, char16_t c, bool color);
 
void Uni_Char(int x1, int y1, char16_t c, bool color);
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
</syntaxhighlight>
|<syntaxhighlight lang="cpp">
+
 
 +
<syntaxhighlight lang="cpp">
 
void loop(){
 
void loop(){
 
   //cách 1:
 
   //cách 1:
Dòng 275: Dòng 240:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Viết 1 chuỗi chữ Việt
 
* Viết 1 chuỗi chữ Việt
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Uni_String(int x, int y, char16_t c[] , bool color);
 
void Uni_String(int x, int y, char16_t c[] , bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void loop(){
 
void loop(){
 
//cách 1:
 
//cách 1:
Dòng 297: Dòng 257:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
+
 
 
* Cách gõ kí tự dạng hex,các bạn cài bộ gõ UNIKEY ở chế độ "Unicode C String" , nhấn "Đóng"rồi gõ như bình thường.
 
* Cách gõ kí tự dạng hex,các bạn cài bộ gõ UNIKEY ở chế độ "Unicode C String" , nhấn "Đóng"rồi gõ như bình thường.
  
 
* Viết chữ số  
 
* Viết chữ số  
 +
<syntaxhighlight lang="cpp">
 
void Number_Long(int x, int y,long a,byte select_font, bool color);
 
void Number_Long(int x, int y,long a,byte select_font, bool color);
 
void Number_Ulong(int x, int y,unsigned long a,byte select_font, bool color);
 
void Number_Ulong(int x, int y,unsigned long a,byte select_font, bool color);
 
void Number_Float(int x, int y, float a,byte n, byte select_font,bool color);
 
void Number_Float(int x, int y, float a,byte n, byte select_font,bool color);
 +
</syntaxhighlight>
  
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
int k=0;// int , long...
 
int k=0;// int , long...
 
byte l=0;// byte, unsigned int, unsigned long...
 
byte l=0;// byte, unsigned int, unsigned long...
Dòng 324: Dòng 285:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
*Vẽ ảnh bitmap
 
*Vẽ ảnh bitmap
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Bitmap(int x, int y, unsigned int w, unsigned int h,const uint8_t *bitmap , bool color);
 
void Bitmap(int x, int y, unsigned int w, unsigned int h,const uint8_t *bitmap , bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
+
<syntaxhighlight lang="cpp">
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
 
|<syntaxhighlight lang="cpp">
 
 
#ifdef __AVR__
 
#ifdef __AVR__
 
#include <avr/io.h>
 
#include <avr/io.h>
Dòng 354: Dòng 309:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
 
  
 
* Xoay và Gương cho ảnh bitmap
 
* Xoay và Gương cho ảnh bitmap
  
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Plus_Bitmap(int x0, int y0, unsigned int w, unsigned int h,const uint8_t *bitmap , int goc, bool mirror, bool color);
 
void Plus_Bitmap(int x0, int y0, unsigned int w, unsigned int h,const uint8_t *bitmap , int goc, bool mirror, bool color);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
+
 
 +
[[Tập tin:Oi.jpg|400px]]
  
 
* Giữ góc  
 
* Giữ góc  
  
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
int Keep_Angle(int goc);
 
int Keep_Angle(int goc);
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Tìm điểm thuộc đường elip
 
* Tìm điểm thuộc đường elip
  
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Find_XY_Elip(int x0, int y0,  int a,  int b,int goc_alpha) ;
 
void Find_XY_Elip(int x0, int y0,  int a,  int b,int goc_alpha) ;
 
int X_Elip();
 
int X_Elip();
 
int Y_Elip()
 
int Y_Elip()
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
 
  
 
* Tìm điểm thuộc mặt cầu
 
* Tìm điểm thuộc mặt cầu
  
{| style="border-radius: 6px 6px 6px 6px;border: 1px dotted"
+
<syntaxhighlight lang="cpp">
|<syntaxhighlight lang="cpp">
 
 
void Find_XY_Sphere(int x0, int y0,  int a, int b, int goc_alpha, int goc_beta);
 
void Find_XY_Sphere(int x0, int y0,  int a, int b, int goc_alpha, int goc_beta);
 
int X_Sphere();
 
int X_Sphere();
 
int Y_Sphere();
 
int Y_Sphere();
 
</syntaxhighlight>
 
</syntaxhighlight>
|}
+
 
 +
[[Tập tin:Oip.jpg|400px]]
  
 
== link tham khảo thêm ==  
 
== link tham khảo thêm ==  
 
[http://arduino.vn/tutorial/1345-nokia5110-huong-dan-su-dung-va-chia-se-thu-vien-hoang-sa  tại đây]
 
[http://arduino.vn/tutorial/1345-nokia5110-huong-dan-su-dung-va-chia-se-thu-vien-hoang-sa  tại đây]

Bản hiện tại lúc 11:49, ngày 2 tháng 3 năm 2018

Editor.png

Bài viết này đang được phát triển hoặc chỉnh sửa lớn.
Bạn có thể đóng góp để bài viết hoàn thiện hơn.
Sau khi chỉnh sửa xong thông báo này sẽ được gỡ bỏ.

Giới thiệu

NO01.jpg
  • Màn hình LCD Nokia 5110 sử dụng IC điều khiển Philips PCD8544, rất thích hợp sử dụng cho các dự án Arduino vì kích thước nhỏ và khả năng hiển thị nhiều kí tự.

Đặc điểm

NOKIA N5110:

  • Kích thước màn hình 84x48 (pixel)
  • IC điều khiển PCD8544
  • Điều khiển độ sáng màn hình bằng xung PWM
  • Điện áp nguồn: 3,5v

Sơ đồ chân

Thứ tự chân Tên gọi Mô tả
1 RST reset
2 CE chip selection
3 DC data/commands choice
4 Din dòng dữ liệu
5 Clk tốc độ Clock
6 Vcc nguồn (5V hoặc 3,3V)
7 BL Backlight control terminal
8 GND mass

Sử dụng

Sơ đồ kết nối

No002.png

Kết nối chân tới Arduino
Thứ tự chân Tên gọi chân tại Arduino
1 RST D3
2 CE D4
3 DC D5
4 Din D6
5 Clk D7
6 Vcc 5V hoặc 3,3v
7 BL 3,3- 5V hoặc không dùng
8 GND GND

thư viện dùng cho Arduino khi sử dụng NOKIA N5110: tại đây

Source code mẫu:

#include <bmps.h>
#include <PCD8544_HOANGSA.h>

PCD8544 lcd(3,4,5,6,7);//b
void setup()   {
  lcd.ON();//c
  lcd.SET(50,0,0,0,4); //d
}
void loop(){
lcd.Asc_String(10,15,Asc("Chipfc.com"), BLACK);
lcd.Display();
}

Một số cú pháp cơ bản

  • Cấu trúc khai báo thư viện
#include "ST7565_homephone.h"//a
ST7565 lcd(3,4,5,6);//b

void setup()   {  
  lcd.ON();//c
  lcd.SET(22,0,0,0,4);   //d
}
void loop(){
  • Cài đặt giao diện
   void SET(byte contrast, bool negative, bool rotation, bool mirror, byte tyledientro);
   Hàm này có thể được gọi nhiều lần với các thông số khác.

   contrast - độ tương phản - giá trị từ 0->63 (0x00 trở xuống 0x3f)
   negative - hiển thị âm bản - giá trị 0 hoặc 1
   rotation - đảo ngược màn hình - giá trị 0 hoặc 1
   mirror - hiển thi gương - giá trị 0 hoặc 1
   tyledientro - bằng R1/R2 - thiết lập điện áp hoạt động- 0 -> 6 (0x0 đến 0x6)
  • Boolean color: chỉ chấp nhận 3 loại sau BLACK (1), WHITE(0), DELETE(0)
  • void Display(); : là hàm cho phép màn hình hiển thị những gì đã vẽ
  • void Clear(); : xóa tất cả màn hình
  • Vẽ 1 điểm có tọa độ x, y
void DrawPixel(int x,int y, bool color);
  • Đọc dữ liệu bộ nhớ
bool GetPixel( int x, int y);
  • Vẽ đoạn thẳng
void DrawLine(int x0,int y0,int x1,int y1,  bool color);
  • Vẽ hình chữ nhật
void Rect(int x,int y, int w, int h, bool color);
  • Tô màu hình chữ nhật
void FillRect(int x,int y, int w, int h, bool color);
  • Hình chữ nhật kèm hiệu ứng bo góc
void Corner( int x,int y, int w, int h,int r, bool color);
  • Vẽ Corner tô màu
void FillCorner( int x,int y,int w,int h, int r, bool color);

On0003.jpg

  • Vẽ tam giác
void Tri (int x1,int y1,int x2,int y2,int x3,int y3, bool color);
  • Vẽ tam giác tô màu
void FillTri(int x1,int y1,int x2,int y2 ,int x3,int y3, bool color);
  • Vẽ đường tròn
void Circle(int x0,int y0,int r, bool color);
  • Vẽ hình tròn tô màu
void FillCircle(int x0,int y0, int r, bool color);
  • Vẽ elip
void Elip( int x, int  y,  int xRadius, int  yRadius, bool color);
  • Vẽ hình elip tô màu
void FillElip(int x0, int y0  , int   xRadius,  int  yRadius, bool color);
  • Viết 1 kí tự trong bảng ASCII
void Asc_Char(int x1, int y1,unsigned char c, bool color);
void loop(){
    //cách 1:
    char text ='A';
    text='A';
    lcd.Asc_Char(10,10,text,BLACK);
    lcd.Display();
    //cách 2:
    
    lcd.Asc_Char(20,10,'B',BLACK);
    lcd.Display();
    //cách 3: dùng bảng mã ASCII
    
    lcd.Asc_Char(30,10,67,BLACK);
    lcd.Display();
}

No004.jpg

  • Viết một chuỗi kí tự
void Asc_String(int x1, int y1,unsigned char c[] , bool color);
void loop(){
    //cách 1: 
    lcd.Asc_String(10,15,Asc(" Nguyen"), BLACK);
    //cách 2: 
    const static unsigned char text[] PROGMEM =" Khuong";
    lcd.Asc_String(10,35,text, BLACK);
    
    lcd.display();
}
  • Viết 1 kí tự tiếng Việt
void Uni_Char(int x1, int y1, char16_t c, bool color);
void loop(){
  //cách 1:
  
  lcd.Uni_Char(63,10,u'A',BLACK);//A
  //cách 2:
  const static char16_t text=u'\x1ED8';//Ộ
  lcd.Uni_Char(63,31,text,BLACK);
lcd.display();
}
  • Viết 1 chuỗi chữ Việt
void Uni_String(int x, int y, char16_t c[] , bool color);
void loop(){
//cách 1:
lcd.Uni_String( 30, 15,Uni( u"\x111\x1ECF"), BLACK);//đỏ
//cách 2:
const static char16_t text[] PROGMEM =u"\x111\x65n";//đen
lcd.Uni_String( 30, 35,text, BLACK);
  	
lcd.Display();
}
  • Cách gõ kí tự dạng hex,các bạn cài bộ gõ UNIKEY ở chế độ "Unicode C String" , nhấn "Đóng"rồi gõ như bình thường.
  • Viết chữ số
void Number_Long(int x, int y,long a,byte select_font, bool color);
void Number_Ulong(int x, int y,unsigned long a,byte select_font, bool color);
void Number_Float(int x, int y, float a,byte n, byte select_font,bool color);
int k=0;// int , long...
byte l=0;// byte, unsigned int, unsigned long...
float m=0.123;
 
void loop(){ 
    
    lcd.Number_Long(10,10,k,STYLE_NUMBER,BLACK);
    lcd.Number_Ulong(10,28,l,CASIO_NUMBER,BLACK);
    lcd.Number_Float(10, 50,m,3,ASCII_NUMBER,BLACK);
    lcd.Display();
    k++;
    l++;
    m++;
    lcd.Clear();
 
}
  • Vẽ ảnh bitmap
void Bitmap(int x, int y, unsigned int w, unsigned int h,const uint8_t *bitmap , bool color);
#ifdef __AVR__
#include <avr/io.h>
#include <avr/pgmspace.h> 
#endif
 
/** bitmap logo 16x 16
*/
const static unsigned char __attribute__ ((progmem)) logo16_glcd_bmp[]= {
0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0xf8, 0xbe, 0x9f, 0xff, 0xf8, 0xc0, 0xc0, 0xc0, 0x80, 0x00, 
0x20, 0x3c, 0x3f, 0x3f, 0x1f, 0x19, 0x1f, 0x7b, 0xfb, 0xfe, 0xfe, 0x07, 0x07, 0x07, 0x03, 0x00, };
 
 
void loop(){
    lcd.Bitmap( 60,30,16,16,logo16_glcd_bmp,BLACK);
    lcd.display();
}
  • Xoay và Gương cho ảnh bitmap
void Plus_Bitmap(int x0, int y0, unsigned int w, unsigned int h,const uint8_t *bitmap , int goc, bool mirror, bool color);

Oi.jpg

  • Giữ góc
int Keep_Angle(int goc);
  • Tìm điểm thuộc đường elip
void Find_XY_Elip(int x0, int y0,  int a,  int b,int goc_alpha) ;
int X_Elip();
int Y_Elip()
  • Tìm điểm thuộc mặt cầu
void Find_XY_Sphere(int x0, int y0,  int a, int b, int goc_alpha, int goc_beta);
int X_Sphere();
int Y_Sphere();

Oip.jpg

link tham khảo thêm

tại đây