Ch3_7. Nokia LCD 디스플레이하기
학습 내용
Nokia LCD에 "Hello World!"문자와 Sine파형을 출력하는 제어를 학습하게됩니다.
배선도 & 회로도
배선 사진
Flow Chart
코딩
// Hello World! for Nokia LCD, sford
// - LCD6610 is for newest Sparkfun breakout
#include "mbed.h"
#include "NokiaLCD.h"
NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
int main() {
lcd.background(0x0000FF);
lcd.cls();
lcd.fill(2, 51, 128, 10, 0x00FF00);
lcd.fill(50, 1, 10, 128, 0xFF0000);
lcd.locate(0,3);
lcd.printf("Hello World!");
for (int i=0; i<130; i++) {
lcd.pixel(i, 80 + sin((float)i / 5.0)*10, 0x000000);
}
}
라이브러리
Import library
Public Types |
|
| enum | LCDType { LCD6100 , LCD6610 } |
|
LCD panel format. More... |
|
Public Member Functions |
|
| NokiaLCD (PinName mosi, PinName sclk, PinName cs, PinName rst, LCDType type=LCD6100) | |
|
Create and Nokia LCD interface, using a SPI and two DigitalOut interfaces.
|
|
| int | putc (int c) |
|
Write a character to the LCD.
|
|
| int | printf (const char *format,...) |
|
Write a formated string to the LCD.
|
|
| void | locate (int column, int row) |
|
Locate to a screen column and row.
|
|
| void | cls () |
|
Clear the screen and locate to 0,0.
|
|
| void | pixel (int x, int y, int colour) |
|
Set a pixel on te screen.
|
|
| void | fill (int x, int y, int width, int height, int colour) |
|
Fill an area of the screen.
|
|
| void | foreground (int c) |
|
Set the foreground colour.
|
|
| void | background (int c) |
|
Set the background colour.
|
|
학습 참고
Please log in to post comments.
