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

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

RonWang1个月前 (11-05)电子编程60

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 001 - LED Blink

Arduino Project 001 - LED Blink

Arduino 电子编程--灯项目及控制,主要使用Arduino编程控制LED灯,实现基本控制Project 1 LED闪烁,基本的应用Project 3和4红绿灯项目项目1 Project...

 Arduino Project 033 - 4 Digital 7 Segment Display

Arduino Project 033 - 4 Digital 7 Segment Display

Showing Heep and number 0-9 on a Common Anode 7-segment LED display. Displays the numbers 0-9 on the...

Arduino Project 045 - RFID Servo and LED Control System

Arduino Project 045 - RFID Servo and LED Control System

Arduino Programming Basic -- RFID Servo and LED Control SystemProject 45 RFID Servo and LED Control...

Arduino Project 016 - L293D Motor Driver IC

Arduino Project 016 - L293D Motor Driver IC

In the previous project, you used a transistor to control the motor. In this project, you are going...

Arduino Project 044 - Simple RFID Reader

Arduino Project 044 - Simple RFID Reader

Arduino Programming Basic -- Making an RFID ReaderProject 44 Simple RFID ReaderWiring Diagram Betwee...

Arduino Project 032 - BMP280 Pressure Sensor LCD Display

Arduino Project 032 - BMP280 Pressure Sensor LCD Display

For this project we will use Arduino Uno and BMP280 along with LCD 16x2 display module to display te...

发表评论

访客

看不清,换一张

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