JavaScript seems to be disabled in your browser.

You must have JavaScript enabled in your browser to utilize the functionality of this website. Click here for instructions on enabling javascript in your browser.

LCD1602 Keypad Shield for Arduino
Varenummer:134-336
Varekode:LCD1602ARD
Vægt:100.0g
Henter lager-information...
Henter lager-information fra leverandører...
Internet-pris
Inkl. moms:
Kr. 159,00
LCD1602ARDLCD1602ARD

This shield is designed for 5V Arduino boards that use the standard Arduino header layout such as the Uno, Leonardo, Mega, etc.

It is compatible with the standard Arduino LiquidCrystal library which is built into the Arduino development environment.

The shield includes a 16 character by 2 line LCD display with exceptionally clear white text on a blue backlit background.

Contrast can be adjusted by means of a multi-turn potentiometer.

Six miniature push buttons (SELECT, LEFT, RIGHT, UP, DOWN & RST) provide a user input and only require one input pin to monitored their state.

Additional interfaces include an ICSP header which can also double as an SPI interface and pads are provided to allow extra optional headers to be added.

Please note: This shield is designed for 5V Arduino boards such as the Uno, Leonardo, Mega, etc. It is not compatible with 3V Arduino boards.
Due to the way the backlight circuit works do not manually configure digital pin 10 as an high output when this shield is connected.


This is a 16x2 LCD Keypad module for ARDUINO Uno/Mega
- Blue Backlight with white text
- Uses standard 4 Bit Arduino LCD Library

Item: LCD Keypad Shield for Arduino Duemilanove & LCD 1602
Dimensions: 3.15 in x 2.28 in x 0.51 in (8.0 cm x 5.8 cm x 1.3 cm)

Kodeeksempeler:

 /*
This is a simple example of how to use the Arduino LCD shield
(LCD1602). The shield will work with the standard Arduino LiquidCrystal library.
This code also demonstrates the correct pinnout for the LCD. When you run this
program you should see "HELLO WORLD!" appear on the first line of the display.

LCD Backlight considerations

By default the LiquidCrystal library does not attempt to control the backlight
and therefore the backlight will default to being permanently on. If you do not
need to change the state of the backlight you can ignore the following information:

When overriding the state of the backlight via DIO10 from your own code, you must
drive the pin in one of two modes:

Backlight   DIO10
OFF          OUTPUT/LOW
ON            INPUT

DO NOT configure DIO to be and OUTPUT/HIGH as this can cause excessive current
to be drawn from DIO10.

You may copy, alter and reuse this code in any way you like but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER. */


/* Include the standard LiquidCrystal library */
#include <LiquidCrystal.h>

/* DIO pin definitions */
#define LCD_DATA4 4         /* LCD data DIO pin 4 */
#define LCD_DATA5 5         /* LCD data DIO pin 5 */
#define LCD_DATA6 6         /* LCD data DIO pin 6 */
#define LCD_DATA7 7         /* LCD data DIO pin 7 */
#define LCD_RESET 8         /* LCD Reset DIO pin */
#define LCD_ENABLE 9        /* LCD Enable DIO pin */
#define LCD_BACKLIGHT 10    /* LCD backlight DIO pin */

/* Initialise the LiquidCrystal library with the correct DIO pins */
LiquidCrystal lcd(LCD_RESET, LCD_ENABLE, LCD_DATA4, LCD_DATA5, LCD_DATA6, LCD_DATA7);

void setup()
{
  /* Set the correct display size (16 character, 2 line display) */
  lcd.begin(16, 2); 
}

/* Main program loop */
void loop()
{
  /* Put the LCD cursor on the first row an print the HELLO WORLD message */
  lcd.setCursor(0,0);
  lcd.print("HELLO WORLD !");
}
 

 -----------------------------------

 

/*
 This is a simple example of how to use the buttons included on the
 Arduino LCD shield (LCD1602). The shield will work
 with the standard Arduino LiquidCrystal library.
 
 The buttons when pressed apply different offset voltages to the
 Arduino ADC0. Reading the ADC will give an ADC code in the following
 range depending on which button has been pressed:

     Between 0 & 49 = RIGHT button pressed.
     Between 50 & 194 = UP button pressed.
     Between 195 & 379 = DOWN button pressed.
     Between 380 & 555 = LEFT button pressed.
     Between 555 & 789 = SELECT button pressed.
 
     Above and ADC code of 790, assume no button has been pressed.
 
LCD Backlight considerations

By default the LiquidCrystal library does not attempt to control the backlight
and therefore the backlight will default to being permanently on. If you do not
need to change the state of the backlight you can ignore the following information:

When overriding the state of the backlight via DIO10 from your own code, you must
drive the pin in one of two modes:

Backlight   DIO10
OFF      OUTPUT/LOW
ON      INPUT

DO NOT configure DIO to be and OUTPUT/HIGH as this can cause excessive current
to be drawn from DIO10.

You may copy, alter and reuse this code in any way you like but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.

*/

/* Include the standard LiquidCrystal library */
#include <LiquidCrystal.h>

/* DIO pin definitions */
#define LCD_DATA4 4         /* LCD data DIO pin 4 */
#define LCD_DATA5 5         /* LCD data DIO pin 5 */
#define LCD_DATA6 6         /* LCD data DIO pin 6 */
#define LCD_DATA7 7         /* LCD data DIO pin 7 */
#define LCD_RESET 8         /* LCD Reset DIO pin */
#define LCD_ENABLE 9        /* LCD Enable DIO pin */
#define LCD_BACKLIGHT 10    /*LCD backlight DIO pin */


/* Definitions for current button state */
typedef enum
{
  E_LCD_BTN_RIGHT,          /* LCD RIGHT button pressed */
  E_LCD_BTN_UP,             /* LCD UP button pressed */
  E_LCD_BTN_DOWN,           /* LCD DOWN button pressed */
  E_LCD_BTN_LEFT,           /* LCD LEFT button pressed */
  E_LCD_BTN_SELECT,         /* LCD SELECT button pressed */
  E_LCD_BTN_NONE,           /* LCD NONE button pressed */
}
teButtonState;       


/* Initiliase the LiquidCrystal library with the correct DIO pins */
LiquidCrystal lcd(LCD_RESET, LCD_ENABLE, LCD_DATA4, LCD_DATA5, LCD_DATA6, LCD_DATA7);


void setup() {

  /* Set the correct display size (16 character, 2 line display) */
  lcd.begin(16, 2); 
}


/* Main program loop */
void loop()
{

  /* Put the LCD cursor on the first row and prompt the user to press a button */
  lcd.setCursor(0,0);
  lcd.print("Press a button...");

  /* Keep checking for a button press */
  while (1)
  {
    /* Put the LCD cursor on the second row */
    lcd.setCursor(0,1);

    /* Get the current state of the LCD buttons */
    switch(iGetLCDButtonState())
    {
      /* If the RIGHT button has been pressed then display this on the LCD */
    case E_LCD_BTN_RIGHT:
      lcd.print("RIGHT ");
      break;

      /* If the LEFT button has been pressed then display this on the LCD */
    case E_LCD_BTN_LEFT:
      lcd.print("LEFT   ");
      break;

      /* If the UP button has been pressed then display this on the LCD */
    case E_LCD_BTN_UP:
      lcd.print("UP    ");
      break;

      /* If the DOWN button has been pressed then display this on the LCD */
    case E_LCD_BTN_DOWN:
      lcd.print("DOWN  ");
      break;

      /* If the SELECT button has been pressed then display this on the LCD */
    case E_LCD_BTN_SELECT:
      lcd.print("SELECT");
      break;

      /* If no button has been pressed then display NONE on the LCD */
    case E_LCD_BTN_NONE:
      lcd.print("NONE  ");
      break;
    }
  }
}

/* Read the current state of the LCD buttons using the ADC */
int iGetLCDButtonState()
{
  int iADC_Value;
  int iADC_Button_State = E_LCD_BTN_NONE;

  iADC_Value = analogRead(0);      /* Read the ADC */


  /* If ADC reads above 1000 then assume no buttons have been pressed */
  if (iADC_Value > 1000)
  {
    iADC_Button_State = E_LCD_BTN_NONE;
  }
  else /* If it was below 1000 then a button is pressed... */
  {

    /* If ADC reads between 0 & 49, then the RIGHT button has been pressed */
    if (iADC_Value < 50)             
    {
      iADC_Button_State = E_LCD_BTN_RIGHT;
    }
    else
    {
      /* If ADC reads between 50 & 194, then the UP button has been pressed */
      if (iADC_Value < 195)
      {     
        iADC_Button_State = E_LCD_BTN_UP;     
      }
      else
      {
        /* If ADC reads between 195 & 379, then the DOWN button has been pressed */
        if (iADC_Value < 380)
        {
          iADC_Button_State = E_LCD_BTN_DOWN;
        }
        else
        {
          /* If ADC reads between 380 & 555, then the LEFT button has been pressed */
          if (iADC_Value < 555) 
          {
            iADC_Button_State = E_LCD_BTN_LEFT;
          }
          else
          {
            /* If ADC reads between 555 & 789, then the SELECT button has been pressed */
            if (iADC_Value < 790) 
              iADC_Button_State = E_LCD_BTN_SELECT; 
          }
        }
      }
    }
  }
  return iADC_Button_State;
}

Del produkt
Del via E-Mail
Del på Facebook Del på Twitter

Kunder der har købt dette produkt har også købt