2013-06-25 56 views
0

如何使用Arduino在液晶顯示屏的兩行上連續顯示長文本?與Arduino液晶接口連接

我試圖使用Arduino在LCD上顯示串行數據,但我輸入的句子在LCD的第一行後被截斷。

+1

如果我們不知道您使用的是哪種LCD,我們無法幫到您。這是一個更好的網站這個問題:http://electronics.stackexchange.com/和我猜你沒有嘗試看液晶顯示器的數據表,因爲那絕對會有你的答案 – Optox

+0

給那種你使用的LCD,到目前爲止你寫的代碼是什麼,你的LCD有多少個字符..? – zmo

回答

2

基本上,使用最常見的液晶顯示器,有a library for Arduino

和示例代碼是:無論你在LCD上打印

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Here is the pinout of your LCD. Read the tutorial to understand what it means. 

void setup() { 
    // Set up the LCD's number of columns and rows: 
    lcd.begin(16, 2); 

    // Prints the first line which is 20 characters wide, padded with spaces, and the 'world!' will be on second line. 
    lcd.print("hello,    world!"); 
} 

void loop() { 
    // Set the cursor to column 0, line 1 (note: line 1 is 
    // the second row, since counting begins with 0): 
    lcd.setCursor(0, 1); 

    // Print the number of seconds since reset: 
    lcd.print(millis()/1000); 
} 

被認爲是一條線。因此,要在兩行上打印文本,需要用空格填充第一行,直到達到行的字符數。接下來的所有文字都會顯示在第二行。