Ks0256 keyestudio LCD1602 Expansion Shield: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
Line 121: Line 121:


==Get One Now ==
==Get One Now ==
'''Official Website'''


http://www.keyestudio.com/keyestudio-pro-micro-development-board-246.html
http://www.keyestudio.com/keyestudio-pro-micro-development-board-246.html

Revision as of 14:47, 14 November 2017

Introduction

Keyestudio LCD1602 expansion shield integrates 1602 LCD display and six buttons into one piece, which is fully compatible with keyestudio UNO R3 control board. It can work just through stacking expansion board on the keyestudio UNO R3 control board, which is very easy and convenient. There are two modes of communication between the 1602 LCD display and keyestudio UNO R3 control board, which are the 8-bit connection method and the four-bit connection method. The expansion board belongs to the four-bit connection method by default. There are six buttons on the expansion board, in which for five control buttons and a reset button. Five control buttons are connected to analog port A0, and when press the different buttons, analog port A0 will output different simulation values. The expansion board has a potentiometer that can be used to adjust the backlight of the display.
thumb

Specification

  • Module Size: 20.5mm * 41mm
  • Display Capacity: 16* 2 characters
  • Chip Working Voltage: 4.5-5.5 V
  • Working Current: 2.0 mA (5.0 V)
  • Module Optimum Working Voltage: 5.0 V
  • Character Size: 2.95 *4.35 (W * H) mm

Sample Code

/*
  Liquid Crystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The Liquid Crystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 8
 * LCD Enable pin to digital pin 9
 * LCD D4 pin to digital pin 4
 * LCD D5 pin to digital pin 5
 * LCD D6 pin to digital pin 6
 * LCD D7 pin to digital pin 7
 * Button pin to analog pin A0
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  Serial.begin(9600);
  // Print a message to the LCD.
  lcd.print("Hello,keyestudio");
}

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);
  int val=analogRead(A0);
  Serial.println(val);
  if(val>=0&&val<=50)
  {
    lcd.setCursor(5,1);
    lcd.print("R");
  }
  else if(val>=50&&val<=150)
  {
    lcd.setCursor(5,1);
    lcd.print("U");
  }
  else if(val>=150&&val<=300)
  {
    lcd.setCursor(5,1);
    lcd.print("D");
  }
  else if(val>=300&&val<=500)
  {
    lcd.setCursor(5,1);
    lcd.print("L");
  }
  else if(val>=500&&val<=750)
  {
    lcd.setCursor(5,1);
    lcd.print("S");
  }
}

Test Result

The keyestudio LCD1602 expansion board is stacked on the control board of keyestudio UNO R3. After the power is turned on, the first line of display shows the text, and the second line firstly shows the number, and the number increases; RST key is a reset button, the number will become zero after pressing RST key. Other five buttons will show relative letters in the back side,such as S U D L R. The following figure is shown in detail.


thumb

Resources

PDF

https://drive.google.com/open?id=1S3uW3f0eyeIyR-5JbVxGLrkFKGzRDsP7

Get One Now

Official Website

http://www.keyestudio.com/keyestudio-pro-micro-development-board-246.html