Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: keypad interfacing on: January 14, 2013, 04:31:55 am
Ya. I have posted it correctly in the code.please. can anyone post the correct code.
2  Using Arduino / Programming Questions / Re: keypad interfacing on: January 13, 2013, 12:56:55 pm
sorry . im new so it happened. il take care next time
3  Using Arduino / Programming Questions / pics using optical mouse on: January 13, 2013, 12:54:13 pm
After interfacing optical mouse with arduino we can get x and y co ordinates on our serial monitor as shown in http://www.martijnthe.nl/2009/07/interfacing-an-optical-mouse-sensor-to-your-arduino/   .  so is it possible to plot those points and create a image sort of thing  similar to using (putpixel) command in C. smiley
4  Using Arduino / Programming Questions / Re: keypad interfacing on: January 13, 2013, 12:46:37 pm
Code:

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
int i = 0;
volatile long int digitOne ;
volatile long int digitTwo ;
volatile long int num;
volatile long int digitThree = 0;

char digitOneChar;
char digitTwoChar;
char digitThreeChar;

char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {7, 6, 5, 4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {11, 10, 9, 8}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
  Serial.println("press A to start");
}

void loop(){
  char key = keypad.getKey();

  if (key != NO_KEY){
    switch (key){
      
    case 'A':
      
      digitOne = 0; digitTwo = 0; digitThree = 0 ;  
      Serial.println("-------------------------");
      Serial.println("enter the triggering angle, in 3 digits");
      Serial.println("-------------------------");
      Serial.println("                         ");
      getNumbers();
      break;
      
    
      
     case 'B':
      
           Serial.println("-------------------------");
           Serial.println("the triggering angle confirmed, which is: ");
           Serial.println(num,BYTE);
           Serial.println("-------------------------");
           Serial.println("                         ");
           break;
          
    }  
  }
}

void getNumbers(){
  i = 0;
  char key = keypad.getKey();

  if (key != NO_KEY){
  while ( i <= 3){
        switch (i){
          case 1:
            digitOneChar = key; i++;
            break;
          case 2:
            digitTwoChar = key; i++;
            break;
          case 3:
            digitThreeChar = key; i++;
            break;
          
            
        }
  }
  }
      
        // convert the char to int
        digitOne = digitOneChar - 48;
        digitTwo = digitTwoChar - 48;
        digitThree = digitThreeChar - 48;
        
        //multiplying each digit so as to form a 3 digit number hundreds + tenths + ones
        digitOne = digitOne * 100;
        digitTwo = digitTwo * 10;
        
        // finding the final 3 digit number
        num = digitOne + digitTwo + digitThree;
        
        
           Serial.println("-------------------------");
           Serial.println("3 digits had been entered");
           Serial.println("press B to confirm, or A to enter again");
           Serial.println("-------------------------");
           Serial.println("                         ");
}
      
5  Using Arduino / Programming Questions / keypad interfacing on: January 13, 2013, 06:23:04 am
im new to arduino group.
please can anyone help me in reading two digit integer no. from keypad. i hv searched a lot on it but all in vain. none of the codes are working.please please do help me . please.
Pages: [1]