Show Posts
Pages: [1]
1  Using Arduino / Displays / Re: LCD keypad shield with arduino uno on: October 17, 2012, 08:53:47 am
thank you so much sir for helping me...these coding helped me a lot.!!! i really appreciate it. smiley-yell
2  Using Arduino / Displays / Re: LCD keypad shield with arduino uno on: October 17, 2012, 08:28:57 am
Even with John's suggestion, your program will not do what you want it to do. What is the business of the "for" loop?

i just want to set the integer value..., i think the control structure "for" might help.. smiley-grin. is it wrong??
3  Using Arduino / Displays / Re: LCD keypad shield with arduino uno on: October 17, 2012, 08:25:12 am
You forgot to call get_key():
Code:
void loop()
{
    int value;
    adc_key_in = get_key(analogRead(A0));   // Add this line

thank you..it helped. but my purpose is to enable push button increase and decrease the integer value. my coding only showing the count. any other suggestion?. sorry im new in this arduino.
4  Using Arduino / Displays / LCD keypad shield with arduino uno on: October 17, 2012, 07:34:04 am
hi... smiley-evil

I have a lcd keypad shield http://www.robotshop.com/dfrobot-lcd-keypad-shield-arduino-1.html and Arduino uno. I want lcd keypad shield displays an integer value ranging from 0 to 100. UP and DOWN push button function to add and reduce the value of the integer. below is an example of coding that I do. my problem now is the push button on the lcd keypad shield is not function and lcd displays continuous count from 0-100 and looping back. how do I solve this problem?? I'm new in Arduino. Which reference language should I choose to enable my programming function as i desired?.any help is greatly appreciated smiley-grin.



#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);


#define RG   0
#define UP   1
#define DW  2
#define LF   3
#define SEL  4



int adc_key_in;
int NUM_KEYS = 5;
int adc_key_val[5] ={30, 150, 360, 535, 760};                          
                    

void setup ()
{
 
  lcd.begin(16, 2);                    
  lcd.clear();                      
  
}



void loop()
{
  
    int value;
    for(value = 0 ; value <= 100; value++)
    
    if(adc_key_in == UP)                  
    {                                      
     value++;
    }
    
    else if(adc_key_in == DW)            
    {      
     value=-1;
    }
    
    
    else
    {                                    
      lcd.setCursor(0,0);                        
      lcd.print("COUNT:");
      lcd.setCursor(0,1);
      lcd.print(value);
      delay(1000);
  
    }
}
  

int get_key(unsigned int input)
{
   int 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;
}



Pages: [1]