Akses keypad 3x4 dengan arduino mega

Akses keypad 3x4 dengan arduino mega

Size
Price:

Read more

konfigurasi pin keypad 3x4 adalah sebagai berikut :




cara pemasangan pin di arduino mega :






sketcth ujicoba keypad

#include <Keypad.h>
const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'#','0','*'}
};
byte rowPins[ROWS] = { 26,36 ,34 ,30  };
byte colPins[COLS] = { 28,24 ,32  };
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  char key = kpd.getKey();
  if(key)  // Check for a valid key.
  {
      Serial.println(key);
  }
}

buka serial monitor kemudian tekan tombol keypad , seharusnya nomer tombol yang ditekan tampil di serial monitor

0 Reviews

Contact form

Name

Email *

Message *