Blink with Keypad library

Hi everybody

I want to turn on a logic probe just when a key is pressed, but this signal follow on. I don´t know how solve this problem. Here is my code:

#include <Keypad.h>

/*Teclado Matrical 4x4 con Arduino
Conecte los pines 1-8 del KeyPad a los pines 2-9 de Arduino
Conecte un led al pin 13 de Arduino
Recuerda descargar la libreria Keypad
const byte ROWS = 4;
const byte COLS = 3;
byte rowPins[ROWS] = {8,7,6,5}; //Filas (pines del 2 al 5)
byte colPins[COLS] = {4,3,2,}; //Columnas (pines del 6 al 9)

char teclas[ROWS][COLS] = {

Keypad teclado = Keypad( makeKeymap(teclas), rowPins, colPins, ROWS, COLS );

char tecla;

void setup(){
pinMode(13, OUTPUT);

void loop()
tecla = teclado.getKey();
if(tecla==‘3’) { switch (teclado.getState())
{case PRESSED:
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);


Please, can you helpme?
Really I don´t know what do

If you had used a symbolic name for your output pin number, you wouldn’t have turned off the wrong one. Also, you can solve a lot of problems by proof reading your code for typographical errors.

What you seem to be doing is to turn on 13 when the key is pressed and turn on 12 when it is released. What is that all about ?

The 12 was used to check if the dispositive was running, but I don´t understand what hapen, or how could I modify this for just be HIGh when a key is pressed

You need to take 13 LOW when a key is not pressed. How about doing it in the place where you currently set 12 HIGH ?

Yes, That is my idea, I just wanna turn on 13 when a key is pressed or take it LOW when a key is not pressed. How can i do it?

In the program
How do you know when a key has been pressed ?
How do you know when a key is not pressed ?