当前位置:首页 > 科学研究 > 电子编程 > 正文内容

Arduino Project 023B - Liquid Crystal Displays -Blink and Cursor

RonWang2个月前 (11-05)电子编程73

Before wiring the LCD screen to your Arduino board we suggest to solder a pin header strip to the 14 (or 16) pin count connector of the LCD screen, as you can see in the image further up.

To start with, you will create a demonstration project that will show off most of the functions available in the LiquidCrystal.h library. To do so, you’ll use a backlit 16x2 LCD Display. 

To wire your LCD screen to your board, connect the following pins:

  • LCD RS pin to digital pin 9

  • LCD Enable pin to digital pin 8

  • LCD D4 pin to digital pin 5

  • LCD D5 pin to digital pin 4

  • LCD D6 pin to digital pin 3

  • LCD D7 pin to digital pin 2

  • LCD R/W pin to GND

  • LCD VSS pin to GND

  • LCD VCC pin to 5V

  • LCD LED+ to 5V through a 220 ohm resistor

  • LCD LED- to GND

Project 23B-1 Liquid Crystal Displays -Blink

/* Coding Ron Wang
   Oct.24th 2024
   Autaba support for coding hardware
   Project 23B  Basic LCD Control - Blink
 */
 
#include <LiquidCrystal.h>
// Initialize the library with the numbers of the interface pins
const int rs = 9, en = 8, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Hello, World!");
}
void loop() {
  // Turn off the blinking cursor:
  lcd.noBlink();
  delay(3000);
  // Turn on the blinking cursor:
  lcd.blink();
  delay(3000);
}

Project 23B-2 Liquid Crystal Displays -Cursor

/* Coding Ron Wang
   Oct.25th 2024
   Autaba support for coding hardware
   Project 23C  Basic LCD Control- Cursor
 */
 
#include <LiquidCrystal.h>
// Initialize the library with the numbers of the interface pins
const int rs = 9, en = 8, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Hello, World!");
}
void loop() {
  // Turn off the cursor:
  lcd.noCursor();
  delay(500);
  // Turn on the cursor:
  lcd.cursor();
  delay(500);
}

Project 23B-3 Liquid Crystal Displays - Set Cursor

/* Coding Ron Wang
   Oct.27th 2024
   Autaba support for coding hardware
   Project 23E  Basic LCD Control- Set Cursor Example
 */
 
#include <LiquidCrystal.h>
// Initialize the library with the numbers of the interface pins
const int rs = 9, en = 8, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// these constants won't change.  But you can change the size of
// your LCD using them:
const int numRows = 2;
const int numCols = 16;
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(numCols, numRows);
}
void loop() {
  // loop from ASCII 'a' to ASCII 'z':
  for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {
    // loop over the columns:
    for (int  thisRow = 0; thisRow < numRows; thisRow++) {
      // loop over the rows:
      for (int thisCol = 0; thisCol < numCols; thisCol++) {
        // set the cursor position:
        lcd.setCursor(thisCol, thisRow);
        // print the letter:
        lcd.write(thisLetter);
        delay(200);
      }
    }
  }
}

Arduino LCD 16X2 Control Autoscroll Circuit

Additionally, wire a 10k potentiometer to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3).

Arduino LCD 16X2 Control Autoscroll

版权声明:本文为原创文章,版权归donstudio所有,欢迎分享本文,转载请保留出处!

本文链接:http://parentscn.com/?id=275

标签: Arduino

相关文章

Arduino Project 025 - Servo Control

Arduino Project 025 - Servo Control

You will need to obtain a standard RC servo; any of the small or mid-sized servos will do. Larger se...

Arduino Project 041 - Ultrasonic Distance OLED 128X64 Display

Arduino Project 041 - Ultrasonic Distance OLED 128X64 Display

About the Ultrasonic sensor knowledge and infor mation click the link : Arduino Project 038 - S...

Arduino Programming Basic - Data Type

Arduino Programming Basic - Data Type

Arduino 程序基础,介绍Arduino程序的基本组成,第一部分编写了10个例子,关于变量及变量名称,串口监视器,if循环,for循环,while循环等。第二部分介绍了函数,全局变量,局部变量和静...

Arduino Programming Basic - Bollean

Arduino Programming Basic - Bollean

Arduino 程序基础,介绍Arduino程序的基本组成,第一部分编写了10个例子,关于变量及变量名称,串口监视器,if循环,for循环,while循环等。第二部分介绍了函数,全局变量,局部变量和静...

Arduino Project 018 - Dual Shift Register 8-Bit Binary Counter

Arduino Project 018 - Dual Shift Register 8-Bit Binary Counter

In Project 18, you will daisy chain (or cascade) another 74HC595 IC onto the one used in Project 17...

 ​Arduino Project 049 - IR Remote Control

​Arduino Project 049 - IR Remote Control

Project 49 IR Remote Control/* Project 49 IR Remote Control  * C...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。