“(SKU:RB-05L007)LCD4884液晶摇杆扩展板”的版本间的差异

来自ALSROBOT WiKi
跳转至: 导航搜索
产品相关推荐
第1行: 第1行:
 
<br/>
 
<br/>
 
[[文件:faef1.jpg|500px|有框|右]]
 
[[文件:faef1.jpg|500px|有框|右]]
 
+
==产品概述==
==概述==
+
最新推出的LCD4884 LCD Joystick Shield v2.0 LCD4884液晶屏扩展板是哈尔滨奥松机器人科技有限公司研发的一款黑白屏液晶扩展板。此扩展板采用Nokia 5110液晶屏为显示器件。SPI接口,最大限度的节省I/O资源。特别添加五向摇杆,方便实现搭建人机互动接口,剩余的模拟与数字接口全部用插针引出,便于安装其它传感器与模块。本品适用于各种开发板和控制器,例如:Arduino控制器、STC单片机、AVR单片机等。
:2012最新推出的LCD4884 LCD Joystick Shield v2.0 LCD4884液晶屏扩展板是哈尔滨奥松机器人科技有限公司研发的一款黑白屏液晶扩展板。此扩展板采用Nokia 5110液晶屏为显示器件。SPI接口,最大限度的节省I/O资源。特别添加五向摇杆,方便实现搭建人机互动接口,剩余的模拟与数字接口全部用插针引出,便于安装其它传感器与模块。本品适用于各种开发板和控制器,例如:Arduino控制器、STC单片机、AVR单片机等。
+
 
==规格参数==
 
==规格参数==
 
# 产品名称:LCD4884液晶摇杆扩展板
 
# 产品名称:LCD4884液晶摇杆扩展板
第18行: 第17行:
 
# 选配配件:3PIN传感器连接线、Arduino 328控制器等
 
# 选配配件:3PIN传感器连接线、Arduino 328控制器等
 
# 板载资源:
 
# 板载资源:
:DIGITAL:8个
+
* 数字接口:8个
:ANALOG IN:5个
+
* 模拟输入借口:5个
:48×84液晶:1个
+
* 48×84液晶:1个
:五项摇杆按键:1个
+
* 无向摇杆按键:1个
:系统复位按键:1个
+
* 系统复位按键:1个
 
+
 
==使用方法==
 
==使用方法==
:先将本模块直接插接至Arduino控制器,再用USB线缆将控制器连接到计算机。
+
===使用硬件===
==LCD4884 Joystick Shield扩展板的测试==
+
* Carduino UNO 控制器 * 1个
:我们使用Arduino控制器来做个测试,要用到硬件设备如下:
+
* LCD4884 Joystick Shield ×1
# Arduino控制器 ×1
+
* USB数据通信线×1
# LCD4884 Joystick Shield ×1
+
===例子程序===
# USB数据通信线×1
+
程序上传前需要先[http://pan.baidu.com/s/1gdg4omv 点此下载]LCD4884 程序使用到的库文件,将它放到Arduino安装目录下的libraries文件夹下
:先将本模块直接插接至Arduino控制器,再用USB线缆将控制器连接到计算机。
+
<pre style='color:blue'>
:本模块需要Arduino 1.0或以上版本。需先添加库文件(注:库文件在您购买本产品后由客服人员提供,如若丢失可凭购买信息向客服人员索取),添加库文件后方能编译,方法是:
+
#include "LCD4884.h"
# 将例程文件包中的“LCD4884_Joystick_Shield_Demo”文件夹拷贝至C:\Program Files\arduino-1.0.1\libraries文件夹下
+
#include "Robotbase_bmp.h"
# 打开Arduino软件,File>Examples>LCD4884_Joystick_Shield_Demo>LCD4884 Demo
+
#include "Robotbase.h"
# 点击软件界面上的下载按钮,片刻后,液晶会有显示。
+
//keypad debounce parameter
:Arduino例程代码详见例程文件包。
+
#define DEBOUNCE_MAX 15
:例程运行效果如下:
+
#define DEBOUNCE_ON  10
 +
#define DEBOUNCE_OFF 3
 +
#define NUM_KEYS 5
 +
#define NUM_MENU_ITEM 4
 +
// joystick number
 +
#define LEFT_KEY 0
 +
#define CENTER_KEY 1
 +
#define DOWN_KEY 2
 +
#define RIGHT_KEY 3
 +
#define UP_KEY 4
 +
// menu starting points
 +
#define MENU_X 10 // 0-83
 +
#define MENU_Y 1 // 0-5
 +
int analogPin = 1;
 +
int ADC_result = 0;
 +
char qian = 0,bai = 0,shi = 0,ge = 0;
 +
int  adc_key_val[5] ={ 50, 200, 400, 600, 800 };
 +
// debounce counters
 +
byte button_count[NUM_KEYS];
 +
// button status - pressed/released
 +
byte button_status[NUM_KEYS];
 +
// button on flags for user program
 +
byte button_flag[NUM_KEYS];
 +
 
 +
// menu definition
 +
char menu_items[NUM_MENU_ITEM][12]={
 +
  "Temperature",
 +
  " Char Map  ",
 +
  "  Picture  ",
 +
  "  About  "
 +
};
 +
void (*menu_funcs[NUM_MENU_ITEM])(void) = {
 +
  temperature,
 +
  charmap,
 +
  bitmap,
 +
  about
 +
};
 +
char current_menu_item;
 +
void setup()
 +
{
 +
  // setup interrupt-driven keypad arrays 
 +
  // reset button arrays
 +
  for(byte i=0; i<NUM_KEYS; i++){
 +
    button_count[i]=0;
 +
    button_status[i]=0;
 +
    button_flag[i]=0;
 +
  }
 +
  // Setup timer2 -- Prescaler/256
 +
  TCCR2A &= ~((1<<WGM21) | (1<<WGM20));
 +
  TCCR2B &= ~(1<<WGM22);
 +
  TCCR2B = (1<<CS22)|(1<<CS21);     
 +
  ASSR |=(0<<AS2);
 +
  // Use normal mode 
 +
  TCCR2A =0;   
 +
  //Timer2 Overflow Interrupt Enable 
 +
  TIMSK2 |= (0<<OCIE2A);
 +
  TCNT2=0x6;  // counting starts from 6; 
 +
  TIMSK2 = (1<<TOIE2);   
 +
  SREG|=1<<SREG_I;
 +
  lcd.LCD_init();
 +
  lcd.LCD_clear();
 +
  //menu initialization
 +
  init_MENU();
 +
  current_menu_item = 0;
 +
  lcd.backlight(ON);//Turn on the backlight
 +
  //lcd.backlight(OFF); // Turn off the backlight 
 +
}
 +
/* loop */
 +
void loop()
 +
{
 +
  byte i;
 +
  for(i=0; i<NUM_KEYS; i++){
 +
    if(button_flag[i] !=0){
 +
      button_flag[i]=0;  // reset button flag
 +
      switch(i){
 +
      case UP_KEY:
 +
        // current item to normal display
 +
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_NORMAL );
 +
        current_menu_item -=1;
 +
        if(current_menu_item <0)  current_menu_item = NUM_MENU_ITEM -1;
 +
        // next item to highlight display
 +
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_HIGHLIGHT );
 +
        break;
 +
      case DOWN_KEY:
 +
        // current item to normal display
 +
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_NORMAL );
 +
        current_menu_item +=1;
 +
        if(current_menu_item >(NUM_MENU_ITEM-1))  current_menu_item = 0;
 +
        // next item to highlight display
 +
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_HIGHLIGHT );
 +
        break;
 +
      case LEFT_KEY:
 +
        init_MENU();
 +
        current_menu_item = 0;
 +
        break; 
 +
      case CENTER_KEY:
 +
        lcd.LCD_clear();
 +
        (*menu_funcs[current_menu_item])();
 +
        lcd.LCD_clear();
 +
        init_MENU();
 +
        current_menu_item = 0;         
 +
        break;
 +
      }
 +
    }
 +
  }
 +
}
 +
/* menu functions */
 +
void init_MENU(void){
 +
  byte i;
 +
  lcd.LCD_clear();
 +
  lcd.LCD_write_string(MENU_X, MENU_Y, menu_items[0], MENU_HIGHLIGHT );
 +
  for (i=1; i<NUM_MENU_ITEM; i++){
 +
    lcd.LCD_write_string(MENU_X, MENU_Y+i, menu_items[i], MENU_NORMAL);
 +
  }
 +
}
 +
// waiting for center key press
 +
void waitfor_OKkey(){
 +
  byte i;
 +
  byte key = 0xFF;
 +
  while (key!= CENTER_KEY){
 +
    for(i=0; i<NUM_KEYS; i++){
 +
      if(button_flag[i] !=0){
 +
        button_flag[i]=0;  // reset button flag
 +
        if(i== CENTER_KEY) key=CENTER_KEY;
 +
      }
 +
    }
 +
  }
 +
}
 +
void temperature()
 +
{
 +
  byte i;
 +
  byte key = 0xFF;
 +
  while (key!= CENTER_KEY){
 +
    ADC_result = analogRead(analogPin);
 +
    qian = ADC_result / 1000;
 +
    bai = ADC_result % 1000 / 100;
 +
    shi = ADC_result % 1000 % 100 / 10;
 +
    ge = ADC_result % 10;
 +
    lcd.LCD_write_char_big(10, 1, '+', MENU_NORMAL);
 +
    lcd.LCD_write_char_big(22, 1, qian-48, MENU_NORMAL);
 +
    lcd.LCD_write_char_big(35, 1, bai-48, MENU_NORMAL);
 +
    lcd.LCD_write_char_big(48, 1, '.', MENU_NORMAL);
 +
    lcd.LCD_write_char_big(51, 1, shi-48, MENU_NORMAL);
 +
    lcd.LCD_write_char_big(64, 1, ge-48, MENU_NORMAL);
 +
    lcd.LCD_write_string(78, 2, "C", MENU_NORMAL);
 +
    lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
 +
    for(i=0; i<NUM_KEYS; i++){
 +
      if(button_flag[i] !=0){
 +
        button_flag[i]=0;  // reset button flag
 +
        if(i== CENTER_KEY) key=CENTER_KEY;
 +
      }
 +
    }
 +
  }
 +
}
 +
void charmap(){
 +
  char i,j;
 +
  for(i=0; i<5; i++){
 +
    for(j=0; j<14; j++){
 +
      lcd.LCD_set_XY(j*6,i);
 +
      lcd.LCD_write_char(i*14+j+32, MENU_NORMAL);
 +
    }
 +
  }
 +
  lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
 +
  waitfor_OKkey(); 
 +
}
 +
void bitmap(){
 +
  lcd.LCD_draw_bmp_pixel(0,0, Robotbase_bmp, 84,24);
 +
  lcd.LCD_write_chinese(12,3, Robotbase_chinese,12,5,0,0);
 +
  lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
 +
  waitfor_OKkey();
 +
}
 +
void about(){
 +
  lcd.LCD_write_string( 0, 0, "LCD4884 Shield", MENU_NORMAL);
 +
  lcd.LCD_write_string( 32, 1, "www", MENU_NORMAL);
 +
  lcd.LCD_write_string( 10, 2, ".robotbase.", MENU_NORMAL);
 +
  lcd.LCD_write_string( 35, 3, "cn", MENU_NORMAL);
 +
  lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
 +
  waitfor_OKkey();
 +
}
 +
// The followinging are interrupt-driven keypad reading functions
 +
// which includes DEBOUNCE ON/OFF mechanism, and continuous pressing detection
 +
// Convert ADC value to key number
 +
char get_key(unsigned int input)
 +
{
 +
  char k;
 +
  for (k = 0; k < NUM_KEYS; k++)
 +
  {
 +
    if (input < adc_key_val[k])
 +
    {
 +
      return k;
 +
    }
 +
  }
 +
  if (k >= NUM_KEYS)
 +
    k = -1;    // No valid key pressed
 +
  return k;
 +
}
 +
void update_adc_key(){
 +
  int adc_key_in;
 +
  char key_in;
 +
  byte i;
 +
  adc_key_in = analogRead(0);
 +
  key_in = get_key(adc_key_in);
 +
  for(i=0; i<NUM_KEYS; i++)
 +
  {
 +
    if(key_in==i)  //one key is pressed
 +
    {
 +
      if(button_count[i]<DEBOUNCE_MAX)
 +
      {
 +
        button_count[i]++;
 +
        if(button_count[i]>DEBOUNCE_ON)
 +
        {
 +
          if(button_status[i] == 0)
 +
          {
 +
            button_flag[i] = 1;
 +
            button_status[i] = 1; //button debounced to 'pressed' status
 +
          }
 +
        }
 +
      }
 +
    }
 +
    else // no button pressed
 +
    {
 +
      if (button_count[i] >0)
 +
      { 
 +
        button_flag[i] = 0;
 +
        button_count[i]--;
 +
        if(button_count[i]<DEBOUNCE_OFF){
 +
          button_status[i]=0;  //button debounced to 'released' status
 +
        }
 +
      }
 +
    }
 +
  }
 +
}
 +
// Timer2 interrupt routine -
 +
// 1/(160000000/256/(256-6)) = 4ms interval
 +
 
 +
ISR(TIMER2_OVF_vect) { 
 +
  TCNT2  = 6;
 +
  update_adc_key();
 +
}
 +
</pre>
 +
===程序效果===
 
[[文件:faef2.jpg|500px|有框|居中]]
 
[[文件:faef2.jpg|500px|有框|居中]]
 
[[文件:faef3.jpg|500px|有框|居中]]
 
[[文件:faef3.jpg|500px|有框|居中]]
第72行: 第310行:
 
[http://www.makerspace.cn/forum.php?mod=viewthread&tid=4009&highlight=lcd4884 LCD4884液晶摇杆扩展板显示应用]<br/>
 
[http://www.makerspace.cn/forum.php?mod=viewthread&tid=4009&highlight=lcd4884 LCD4884液晶摇杆扩展板显示应用]<br/>
 
[http://www.makerspace.cn/forum.php?mod=viewthread&tid=3250&highlight=lcd4884 关于arduino的LCD4884的使用]
 
[http://www.makerspace.cn/forum.php?mod=viewthread&tid=3250&highlight=lcd4884 关于arduino的LCD4884的使用]
 
 
===相关学习资料===
 
===相关学习资料===
 
[http://v.youku.com/v_show/id_XNDU0MzE5NjIw.html 操作视频]<br/>
 
[http://v.youku.com/v_show/id_XNDU0MzE5NjIw.html 操作视频]<br/>
 
[http://www.makerspace.cn/portal.php 奥松机器人技术论坛]
 
[http://www.makerspace.cn/portal.php 奥松机器人技术论坛]

2015年10月29日 (四) 14:17的版本


Faef1.jpg

目录

产品概述

最新推出的LCD4884 LCD Joystick Shield v2.0 LCD4884液晶屏扩展板是哈尔滨奥松机器人科技有限公司研发的一款黑白屏液晶扩展板。此扩展板采用Nokia 5110液晶屏为显示器件。SPI接口,最大限度的节省I/O资源。特别添加五向摇杆,方便实现搭建人机互动接口,剩余的模拟与数字接口全部用插针引出,便于安装其它传感器与模块。本品适用于各种开发板和控制器,例如:Arduino控制器、STC单片机、AVR单片机等。

规格参数

  1. 产品名称:LCD4884液晶摇杆扩展板
  2. 产品货号:RB-05L007
  3. 工作电压:DC5V
  4. 产品类型:Arduino扩展板
  5. 制作工艺:FR4双面喷锡
  6. 人性化设计:具有可人机互动接口“五项摇杆”
  7. 工作温度:10℃-30℃
  8. 重量:28g
  9. 产品尺寸:69.47mm x 53.34mm x 18mm
  10. 发货清单:LCD4884液晶摇杆扩展板×1
  11. 包装方式:静电袋密封
  12. 选配配件:3PIN传感器连接线、Arduino 328控制器等
  13. 板载资源:
  • 数字接口:8个
  • 模拟输入借口:5个
  • 48×84液晶:1个
  • 无向摇杆按键:1个
  • 系统复位按键:1个

使用方法

使用硬件

  • Carduino UNO 控制器 * 1个
  • LCD4884 Joystick Shield ×1
  • USB数据通信线×1

例子程序

程序上传前需要先点此下载LCD4884 程序使用到的库文件,将它放到Arduino安装目录下的libraries文件夹下

#include "LCD4884.h"
#include "Robotbase_bmp.h"
#include "Robotbase.h"
//keypad debounce parameter
#define DEBOUNCE_MAX 15
#define DEBOUNCE_ON  10
#define DEBOUNCE_OFF 3 
#define NUM_KEYS 5
#define NUM_MENU_ITEM	4
// joystick number
#define LEFT_KEY 0
#define CENTER_KEY 1
#define DOWN_KEY 2
#define RIGHT_KEY 3
#define UP_KEY 4
// menu starting points
#define MENU_X	10		// 0-83
#define MENU_Y	1		// 0-5
int analogPin = 1;
int ADC_result = 0;
char qian = 0,bai = 0,shi = 0,ge = 0;
int  adc_key_val[5] ={ 50, 200, 400, 600, 800 };
// debounce counters
byte button_count[NUM_KEYS];
// button status - pressed/released
byte button_status[NUM_KEYS];
// button on flags for user program 
byte button_flag[NUM_KEYS];

// menu definition
char menu_items[NUM_MENU_ITEM][12]={
  "Temperature",
  " Char Map  ",
  "  Picture  ",
  "   About   "	
};
void (*menu_funcs[NUM_MENU_ITEM])(void) = {
  temperature,
  charmap,
  bitmap,
  about
};
char current_menu_item;
void setup()
{
  // setup interrupt-driven keypad arrays  
  // reset button arrays
  for(byte i=0; i<NUM_KEYS; i++){
    button_count[i]=0;
    button_status[i]=0;
    button_flag[i]=0;
  }
  // Setup timer2 -- Prescaler/256
  TCCR2A &= ~((1<<WGM21) | (1<<WGM20));
  TCCR2B &= ~(1<<WGM22);
  TCCR2B = (1<<CS22)|(1<<CS21);      
  ASSR |=(0<<AS2);
  // Use normal mode  
  TCCR2A =0;    
  //Timer2 Overflow Interrupt Enable  
  TIMSK2 |= (0<<OCIE2A);
  TCNT2=0x6;  // counting starts from 6;  
  TIMSK2 = (1<<TOIE2);    
  SREG|=1<<SREG_I;
  lcd.LCD_init();
  lcd.LCD_clear();
  //menu initialization
  init_MENU();
  current_menu_item = 0;	
  lcd.backlight(ON);//Turn on the backlight
  //lcd.backlight(OFF); // Turn off the backlight  
}
/* loop */
void loop()
{
  byte i;
  for(i=0; i<NUM_KEYS; i++){
    if(button_flag[i] !=0){
      button_flag[i]=0;  // reset button flag
      switch(i){
      case UP_KEY:
        // current item to normal display
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_NORMAL );
        current_menu_item -=1;
        if(current_menu_item <0)  current_menu_item = NUM_MENU_ITEM -1;
        // next item to highlight display
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_HIGHLIGHT );
        break;
      case DOWN_KEY:
        // current item to normal display
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_NORMAL );
        current_menu_item +=1;
        if(current_menu_item >(NUM_MENU_ITEM-1))  current_menu_item = 0;
        // next item to highlight display
        lcd.LCD_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_HIGHLIGHT );
        break;
      case LEFT_KEY:
        init_MENU();
        current_menu_item = 0;
        break;   
      case CENTER_KEY:
        lcd.LCD_clear();
        (*menu_funcs[current_menu_item])();
        lcd.LCD_clear();
        init_MENU();
        current_menu_item = 0;           
        break;	
      }
    }
  }
}
/* menu functions */
void init_MENU(void){
  byte i;
  lcd.LCD_clear();
  lcd.LCD_write_string(MENU_X, MENU_Y, menu_items[0], MENU_HIGHLIGHT );
  for (i=1; i<NUM_MENU_ITEM; i++){
    lcd.LCD_write_string(MENU_X, MENU_Y+i, menu_items[i], MENU_NORMAL);
  }
}
// waiting for center key press
void waitfor_OKkey(){
  byte i;
  byte key = 0xFF;
  while (key!= CENTER_KEY){
    for(i=0; i<NUM_KEYS; i++){
      if(button_flag[i] !=0){
        button_flag[i]=0;  // reset button flag
        if(i== CENTER_KEY) key=CENTER_KEY;
      }
    }
  }
}
void temperature()
{
  byte i;
  byte key = 0xFF;
  while (key!= CENTER_KEY){
    ADC_result = analogRead(analogPin);
    qian = ADC_result / 1000;
    bai = ADC_result % 1000 / 100;
    shi = ADC_result % 1000 % 100 / 10;
    ge = ADC_result % 10;
    lcd.LCD_write_char_big(10, 1, '+', MENU_NORMAL);
    lcd.LCD_write_char_big(22, 1, qian-48, MENU_NORMAL);
    lcd.LCD_write_char_big(35, 1, bai-48, MENU_NORMAL);
    lcd.LCD_write_char_big(48, 1, '.', MENU_NORMAL);
    lcd.LCD_write_char_big(51, 1, shi-48, MENU_NORMAL);
    lcd.LCD_write_char_big(64, 1, ge-48, MENU_NORMAL);
    lcd.LCD_write_string(78, 2, "C", MENU_NORMAL);
    lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
    for(i=0; i<NUM_KEYS; i++){
      if(button_flag[i] !=0){
        button_flag[i]=0;  // reset button flag
        if(i== CENTER_KEY) key=CENTER_KEY;
      }
    }
  }
}
void charmap(){
  char i,j;
  for(i=0; i<5; i++){
    for(j=0; j<14; j++){
      lcd.LCD_set_XY(j*6,i);
      lcd.LCD_write_char(i*14+j+32, MENU_NORMAL);
    }
  }
  lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
  waitfor_OKkey();   
}
void bitmap(){
  lcd.LCD_draw_bmp_pixel(0,0, Robotbase_bmp, 84,24);
  lcd.LCD_write_chinese(12,3, Robotbase_chinese,12,5,0,0);
  lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
  waitfor_OKkey();
}
void about(){
  lcd.LCD_write_string( 0, 0, "LCD4884 Shield", MENU_NORMAL);
  lcd.LCD_write_string( 32, 1, "www", MENU_NORMAL);
  lcd.LCD_write_string( 10, 2, ".robotbase.", MENU_NORMAL);
  lcd.LCD_write_string( 35, 3, "cn", MENU_NORMAL);
  lcd.LCD_write_string(36, 5, "OK", MENU_HIGHLIGHT );
  waitfor_OKkey();
}
// The followinging are interrupt-driven keypad reading functions
// which includes DEBOUNCE ON/OFF mechanism, and continuous pressing detection
// Convert ADC value to key number
char get_key(unsigned int input)
{
  char k;
  for (k = 0; k < NUM_KEYS; k++)
  {
    if (input < adc_key_val[k])
    {
      return k;
    }
  }
  if (k >= NUM_KEYS)
    k = -1;     // No valid key pressed
  return k;
}
void update_adc_key(){
  int adc_key_in;
  char key_in;
  byte i;
  adc_key_in = analogRead(0);
  key_in = get_key(adc_key_in);
  for(i=0; i<NUM_KEYS; i++)
  {
    if(key_in==i)  //one key is pressed 
    { 
      if(button_count[i]<DEBOUNCE_MAX)
      {
        button_count[i]++;
        if(button_count[i]>DEBOUNCE_ON)
        {
          if(button_status[i] == 0)
          {
            button_flag[i] = 1;
            button_status[i] = 1; //button debounced to 'pressed' status
          }
        }
      }
    }
    else // no button pressed
    {
      if (button_count[i] >0)
      {  
        button_flag[i] = 0;	
        button_count[i]--;
        if(button_count[i]<DEBOUNCE_OFF){
          button_status[i]=0;   //button debounced to 'released' status
        }
      }
    }
  }
}
// Timer2 interrupt routine -
// 1/(160000000/256/(256-6)) = 4ms interval

ISR(TIMER2_OVF_vect) {  
  TCNT2  = 6;
  update_adc_key();
}

程序效果

Faef2.jpg
Faef3.jpg
Faef4.jpg
Faef5.jpg

视频演示

LCD4884 01.png


















产品相关推荐

Erweima.png

购买地址

LCD4884液晶摇杆扩展板

周边产品推荐

1602液晶显示器 蓝白屏
Arduino IIC/I2C LCD1602 字符液晶显示器

相关问题解答

LCD4884液晶摇杆扩展板显示应用
关于arduino的LCD4884的使用

相关学习资料

操作视频
奥松机器人技术论坛