Quantcast
Viewing all articles
Browse latest Browse all 18089

Re: Intel Galileo keypad

@L3X wrote:

 

i have tried, but i don't know if i implemented very well...i put the first pin(row 1) on digital pin 2 and 5th pin(column 1) on digital pin 6. I assume that when i press button 1 from keypad both pins(2 and 6) will be HIGH. no ?.  Please tell me if my implementation is good.

 

 

int pushButton = 2;

int pushButton2 = 6;

 

// the setup routine runs once when you press reset:

void setup() {

  // initialize serial communication at 9600 bits per second:

  Serial.begin(9600);

  // make the pushbutton's pin an input:

  pinMode(pushButton, INPUT);

  pinMode(pushButton2, INPUT);                 

}

 

// the loop routine runs over and over again forever:

void loop() {

  // read the input pin:

  int buttonState = digitalRead(pushButton);

  int buttonState2= digitalRead(pushButton2);

  // print out the state of the button:

  if(buttonState==HIGH && buttonState2==HIGH){

  Serial.println("tasta1");}

  delay(1);        // delay in between reads for stability

}

I'm not sure I am understanding what you are trying to do. I thought that you wanted to install and use a keyboard library, but your code here is attempting to raw read the switch closures. Also, it looks like you are setting both bits to input and expecting them to go high when the key is pressed - I don't now how that could work.

 

There is a ton of info on such topics, but take a look at this article and code Interfacing hex keypad to arduino.Full circuit diagram, theory and program and see if it clarifies the situation for you - they have done a good job of explaining the situation and include the code. I would also suggest that first you use a meter to check that your keypad is working the way you think.


Viewing all articles
Browse latest Browse all 18089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>